Skip to content

Commit 58229e8

Browse files
committed
Fix push on tag creation
1 parent 583d703 commit 58229e8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/deploy.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
sarif_file: 'trivy-results.sarif'
4242

4343
- name: Login to Docker Hub
44-
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
4544
uses: docker/login-action@v1
4645
with:
4746
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -52,7 +51,12 @@ jobs:
5251
run: |-
5352
docker push $IMAGE_NAME:latest
5453
54+
- name: Set tag in environment
55+
if: contains(github.ref, 'refs/tags/')
56+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
57+
5558
- name: Push tagged image
56-
if: contains(github.ref, 'refs/tags/v')
59+
if: contains(github.ref, 'refs/tags/')
5760
run: |-
58-
docker push $IMAGE_NAME:$GITHUB_TAG
61+
docker tag $IMAGE_NAME:${{ github.sha }} $IMAGE_NAME:$RELEASE_VERSION
62+
docker push $IMAGE_NAME:$RELEASE_VERSION

0 commit comments

Comments
 (0)