From a646ef1edc68ae1f7ac68008cf5a4bb6846520f0 Mon Sep 17 00:00:00 2001 From: Alex Dyakonov Date: Wed, 29 Jan 2025 21:33:15 +0300 Subject: [PATCH] added versuib abd short SHA to envs --- .github/workflows/cd-production.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-production.yaml b/.github/workflows/cd-production.yaml index 10e25f5..a0d23b2 100644 --- a/.github/workflows/cd-production.yaml +++ b/.github/workflows/cd-production.yaml @@ -28,6 +28,21 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 + + - name: Set short git commit SHA + id: vars + run: | + calculatedSha=$(git rev-parse --short ${{ github.sha }}) + echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV + + - name: Determine Version tag + id: tag + run: | + if [ "${{ github.event_name }}" == "release" ]; then + echo "VERSION_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + else + echo "VERSION_TAG=${{ env.COMMIT_SHORT_SHA }}" >> $GITHUB_ENV + fi - name: Log in to Docker Hub uses: docker/login-action@v2 @@ -44,7 +59,7 @@ jobs: push: true tags: | ${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:latest - ${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:${{ github.event.inputs.tag_name }} + ${{ secrets.DOCKER_USERNAME }}/dishdash-dashboard:${{ env.VERSION_TAG }} - name: Docker hub push notification uses: containrrr/shoutrrr-action@v1