107 lines
4.1 KiB
YAML
107 lines
4.1 KiB
YAML
kind: pipeline
|
|
type: kubernetes
|
|
name: default
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- tag
|
|
|
|
services:
|
|
- name: docker
|
|
image: docker.io/library/docker:25.0.3-git
|
|
privileged: true
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
|
|
steps:
|
|
|
|
- name: get-app-version
|
|
image: steamcmd/steamcmd:alpine-3
|
|
commands:
|
|
- |
|
|
APP_BUILD_ID=$(steamcmd +login anonymous +app_info_print 1690800 +quit | \
|
|
awk 'BEGIN { capture = 0; } \
|
|
/"1690800"/ { capture = 1; } \
|
|
capture && /"branches"/ { inBranches = 1; } \
|
|
inBranches && /"public"/ { inPublic = 1; next; } \
|
|
inPublic && /"buildid"/ { \
|
|
gsub(/[^0-9]/, "", $0); print; exit; \
|
|
}')
|
|
- echo "export APP_BUILD_ID=$${APP_BUILD_ID}" > /scratch/EXTRA_ENVIRONMENT
|
|
- cat /scratch/EXTRA_ENVIRONMENT
|
|
volumes:
|
|
- name: scratch
|
|
path: /scratch
|
|
|
|
- name: build
|
|
image: docker.io/library/docker:25.0.3-git
|
|
commands:
|
|
- sleep 10 # give docker enough time to initialize
|
|
- docker image build --tag image:latest .
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
|
|
- name: push-gitea
|
|
image: docker.io/library/docker:25.0.3-git
|
|
commands:
|
|
- source /scratch/EXTRA_ENVIRONMENT
|
|
- echo $GITEA_TOKEN | docker login git.williammiceli.systems --username $GITEA_USERNAME --password-stdin
|
|
- docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:latest
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:${DRONE_SEMVER_MAJOR}; fi
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}; fi
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}.${DRONE_SEMVER_PATCH}; fi
|
|
- docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:app_build_id$${APP_BUILD_ID}
|
|
- docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:ci_build${DRONE_BUILD_NUMBER}
|
|
- docker image tag image:latest git.williammiceli.systems/william/docker_satisfactory-server:commit_sha${DRONE_COMMIT_SHA:0:12}
|
|
- docker image push --all-tags git.williammiceli.systems/william/docker_satisfactory-server
|
|
depends_on:
|
|
- build
|
|
- get-app-version
|
|
environment:
|
|
GITEA_USERNAME:
|
|
from_secret: GITEA_USERNAME
|
|
GITEA_TOKEN:
|
|
from_secret: GITEA_TOKEN
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
- name: scratch
|
|
path: /scratch
|
|
|
|
- name: push-dockerhub
|
|
image: docker.io/library/docker:25.0.3-git
|
|
commands:
|
|
- source /scratch/EXTRA_ENVIRONMENT
|
|
- echo $DOCKER_TOKEN | docker login docker.io --username $DOCKER_USERNAME --password-stdin
|
|
- docker image tag image:latest docker.io/williammiceli/satisfactory-server:latest
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest docker.io/williammiceli/satisfactory-server:${DRONE_SEMVER_MAJOR}; fi
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest docker.io/williammiceli/satisfactory-server:${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}; fi
|
|
- if [ -n "$DRONE_SEMVER" ]; then docker image tag image:latest docker.io/williammiceli/satisfactory-server:${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}.${DRONE_SEMVER_PATCH}; fi
|
|
- docker image tag image:latest docker.io/williammiceli/satisfactory-server:app_build_id$${APP_BUILD_ID}
|
|
- docker image tag image:latest docker.io/williammiceli/satisfactory-server:ci_build${DRONE_BUILD_NUMBER}
|
|
- docker image tag image:latest docker.io/williammiceli/satisfactory-server:commit_sha${DRONE_COMMIT_SHA:0:12}
|
|
- docker image push --all-tags docker.io/williammiceli/satisfactory-server
|
|
depends_on:
|
|
- build
|
|
- get-app-version
|
|
environment:
|
|
DOCKER_USERNAME:
|
|
from_secret: DOCKER_USERNAME
|
|
DOCKER_TOKEN:
|
|
from_secret: DOCKER_TOKEN
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
- name: scratch
|
|
path: /scratch
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
temp: {}
|
|
- name: scratch
|
|
temp: {} |