From 0b0de7a8ccd4d0b905e1d757431871302e6fd0d9 Mon Sep 17 00:00:00 2001 From: Nina Bernick Date: Fri, 26 Jul 2024 11:27:22 -0700 Subject: [PATCH] conditionally set docker tag -- testing only --- .github/workflows/build-and-push.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 825d810..4dc34c3 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -47,8 +47,14 @@ jobs: release-type: simple token: ${{ secrets.GITHUB_TOKEN }} - - name: Print version - run: echo "Calculated version is ${{ steps.release.outputs.version }}" + - name: Determine Docker tag + id: docker_tag + run: | + if [ "${{ github.ref }}" == "refs/heads/main" ]; then + echo "::set-output name=tag::${{ steps.release.outputs.version }}" + else + echo "::set-output name=tag::latest" + fi - name: Build and push Docker image uses: docker/build-push-action@v2 @@ -56,5 +62,4 @@ jobs: context: . push: true tags: | - ghcr.io/${{ github.repository }}-test:latest - ghcr.io/${{ github.repository }}-test:${{ steps.release.outputs.version }} + ghcr.io/${{ github.repository }}-test:${{ steps.docker_tag.outputs.version }}