From cb6f8f4ba394d022f562d58872b1c0d0ee248c5b Mon Sep 17 00:00:00 2001 From: Shahrad Elahi Date: Mon, 2 Oct 2023 14:49:36 +0330 Subject: [PATCH] update --- .github/workflows/docker-image.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml index 3b825a6..6699a41 100644 --- a/.github/workflows/docker-image.yaml +++ b/.github/workflows/docker-image.yaml @@ -9,8 +9,6 @@ on: env: IMAGE_NAME: shahradelahi/wireadmin - # By default, image tag is the commit SHA - IMAGE_TAG: ${{ github.sha }} jobs: build: @@ -29,13 +27,18 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.PRIVATE_TOKEN }} - # if it was a release tag, use the tag as the image tag + # If it was a release tag, use the tag as the image tag, + # and otherwise image tag is the commit SHA - name: Set image tag - if: startsWith(github.ref, 'refs/tags/v') run: | - echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - echo "IMAGE_TAG=${IMAGE_TAG//./-}" >> $GITHUB_ENV echo "RELEASE_TAG=,ghcr.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV + if [[ $GITHUB_REF == refs/tags/v* ]]; then + echo "Labeling image with TAG: ${GITHUB_REF#refs/tags/v}" + echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + else + echo "Labeling image with commit SHA: ${GITHUB_SHA}" + echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV + fi - name: Push to GitHub Container Registry uses: docker/build-push-action@v4