Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
.github/workflows: Automatically figure out SRCDS-based game images t…
Browse files Browse the repository at this point in the history
…o build and publish

Signed-off-by: Timo Reichl <[email protected]>
  • Loading branch information
Timo Reichl committed Jun 6, 2022
1 parent 8f11e14 commit 2199667
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 15 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
DOCKER_BUILDKIT: 1
REGISTRY_IMAGE: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-build"
DOCKER_IMAGE_TYPES: "base srcds bms csgo css dods gm hl2mp l4d l4d2"
DOCKER_IMAGE_BASE_ORDER: "base srcds"

jobs:
build:
Expand All @@ -20,8 +20,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Build images
- name: Build base images
run: |
for docker_image_type in ${DOCKER_IMAGE_TYPES}; do
docker-compose build ${docker_image_type}
for docker_base_image_type in ${DOCKER_IMAGE_BASE_ORDER}; do
docker-compose build ${docker_base_image_type}
done
- name: Build SRCDS-based game images
run: |
for docker_srcds_game in $(ls image/games/srcds); do
docker-compose build ${docker_srcds_game}
done
24 changes: 18 additions & 6 deletions .github/workflows/docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
DOCKER_BUILDKIT: 1
REGISTRY_IMAGE: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}"
DOCKER_IMAGE_TYPES: "base srcds bms csgo css dods gm hl2mp l4d l4d2"
DOCKER_IMAGE_BASE_ORDER: "base srcds"

jobs:
build:
Expand All @@ -23,13 +23,25 @@ jobs:
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push latest images
- name: Build and push latest base images
run: |
for docker_image_type in ${DOCKER_IMAGE_TYPES}; do
docker-compose build ${docker_image_type}
for docker_base_image_type in ${DOCKER_IMAGE_BASE_ORDER}; do
docker-compose build ${docker_base_image_type}
src_docker_image=${REGISTRY_IMAGE}:${docker_image_type}
dst_docker_image=${REGISTRY_IMAGE}:${docker_image_type}-latest
src_docker_image=${REGISTRY_IMAGE}:${docker_base_image_type}
dst_docker_image=${REGISTRY_IMAGE}:${docker_base_image_type}-latest
docker tag ${src_docker_image} ${dst_docker_image}
docker push ${dst_docker_image}
done
- name: Build and push latest SRCDS-based game images
run: |
for docker_srcds_game in $(ls image/games/srcds); do
docker-compose build ${docker_srcds_game}
src_docker_image=${REGISTRY_IMAGE}:${docker_srcds_game}
dst_docker_image=${REGISTRY_IMAGE}:${docker_srcds_game}-latest
docker tag ${src_docker_image} ${dst_docker_image}
docker push ${dst_docker_image}
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/docker-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
DOCKER_BUILDKIT: 1
REGISTRY_IMAGE: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}"
DOCKER_IMAGE_TYPES: "base srcds bms csgo css dods gm hl2mp l4d l4d2"
DOCKER_IMAGE_BASE_ORDER: "base srcds"

jobs:
retag:
Expand All @@ -23,11 +23,22 @@ jobs:
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Publish tagged images
- name: Publish tagged base images
run: |
for docker_image_type in ${DOCKER_IMAGE_TYPES}; do
src_docker_image=${REGISTRY_IMAGE}:${docker_image_type}-latest
dst_docker_image=${REGISTRY_IMAGE}:${docker_image_type}-${{ github.ref_name }}
for docker_base_image_type in ${DOCKER_IMAGE_BASE_ORDER}; do
src_docker_image=${REGISTRY_IMAGE}:${docker_base_image_type}-latest
dst_docker_image=${REGISTRY_IMAGE}:${docker_base_image_type}-${{ github.ref_name }}
docker pull ${src_docker_image}
docker tag ${src_docker_image} ${dst_docker_image}
docker push ${dst_docker_image}
done
- name: Publish tagged SRCDS-based game images
run: |
for docker_srcds_game in $(ls image/games/srcds); do
src_docker_image=${REGISTRY_IMAGE}:${docker_srcds_game}-latest
dst_docker_image=${REGISTRY_IMAGE}:${docker_srcds_game}-${{ github.ref_name }}
docker pull ${src_docker_image}
docker tag ${src_docker_image} ${dst_docker_image}
Expand Down

0 comments on commit 2199667

Please sign in to comment.