From e784bc4ce4bb6b7f5e0189dbb3329b73cc406994 Mon Sep 17 00:00:00 2001 From: Brandon Sturgeon Date: Tue, 30 Jan 2024 00:23:06 -0800 Subject: [PATCH] Conditional minor tag --- .github/workflows/build_and_push.yml | 23 +++++++++++++++++------ docker/docker-compose.yml | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index b72c81b..3e5ec0e 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -61,14 +61,16 @@ jobs: cd $GITHUB_WORKSPACE/docker BASE=ghcr.io/cfc-servers/gluatest + rawVersionTag=${{ inputs.tag_name }} + publicID=$(cat $GITHUB_WORKSPACE/gmod_buildid_public.txt) $GITHUB_WORKSPACE/docker-slim build \ --target gluatest_fat_live:latest \ --http-probe-off \ --continue-after 30 \ --show-clogs --show-blogs \ - --tag "$BASE":${{ inputs.tag_name }} \ - --tag "$BASE":gameversion-$publicID + --tag $BASE:$rawVersionTag \ + --tag $BASE:gameversion-$publicID x86ID=$(cat $GITHUB_WORKSPACE/gmod_buildid_x86.txt) $GITHUB_WORKSPACE/docker-slim build \ @@ -76,13 +78,22 @@ jobs: --http-probe-off \ --continue-after 30 \ --show-clogs --show-blogs \ - --tag "$BASE"/64bit:${{ inputs.tag_name }} \ - --tag "$BASE"/64bit:gameversion-$x86ID + --tag $BASE/64bit:$rawVersionTag \ + --tag $BASE/64bit:gameversion-$x86ID + + # Tag image with "0.27" if we push tag "0.27.5" + # but not if we push tag "0.27-pre5" + parentMinorVersion=${rawVersionTag%.*} + if [[ parentMinorVersion != "0" ]]; then + echo "::warning:: Tagging with parent minor version: $parentMinorVersion" + docker tag $BASE:$rawVersionTag $BASE:$parentMinorVersion + docker tag $BASE/64bit:$rawVersionTag $BASE:$parentMinorVersion + fi if [ "${{ inputs.release }}" = "true" ]; then echo "::warning:: Tagging this release as the latest!" - docker tag "$BASE":${{ inputs.tag_name }} "$BASE":latest - docker tag "$BASE"/64bit:${{ inputs.tag_name }} "$BASE"/64bit:latest + docker tag $BASE:$rawVersionTag $BASE:latest + docker tag $BASE/64bit:$rawVersionTag $BASE/64bit:latest fi - name: Login to GitHub Container Registry diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f513bc3..ab0bcae 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: runner: - image: ghcr.io/cfc-servers/gluatest:0.27-pre19 + image: ghcr.io/cfc-servers/gluatest:0.27-pre21 build: . container_name: gluatest_runner stop_grace_period: 2s