From 2482298d3de1cce5cf26e3faf9f3fd599b2df157 Mon Sep 17 00:00:00 2001 From: mgrochalskisoldevelo Date: Thu, 7 Nov 2024 15:21:11 +0100 Subject: [PATCH] Update Docker Image deployment --- .github/workflows/change-log-docker-image.yml | 14 ++++++++++++-- .gitignore | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/change-log-docker-image.yml b/.github/workflows/change-log-docker-image.yml index d6af30a..dcf35c1 100644 --- a/.github/workflows/change-log-docker-image.yml +++ b/.github/workflows/change-log-docker-image.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - 'release/**' + - 'rel-*' jobs: build-export: @@ -24,6 +24,16 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set Version Tag + run: | + branch_name="${GITHUB_REF##*/}" + if [[ "$branch_name" == "main" ]]; then + VERSION_TAG="main" + else + VERSION_TAG=${branch_name/rel-/} + fi + echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV + - name: Build and push Docker image uses: docker/build-push-action@v2 with: @@ -31,7 +41,7 @@ jobs: push: true tags: | ghcr.io/openlmis-angola/open-lmis-changelog:latest - ghcr.io/openlmis-angola/open-lmis-changelog:${{ github.ref_name }} + ghcr.io/openlmis-angola/open-lmis-changelog:${{ env.VERSION_TAG }} - name: Log out of GitHub Container Registry run: docker logout ghcr.io diff --git a/.gitignore b/.gitignore index 4c49bd7..de03f38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.idea .env