File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name: Test & build Docker image
33on :
44 push :
55 branches : [ master ]
6+ tags : ['*']
67 pull_request :
78
89env :
4142 sarif_file : ' trivy-results.sarif'
4243
4344 - name : Login to Docker Hub
44- if : github.ref == 'refs/heads/master' && github.event_name == 'push'
4545 uses : docker/login-action@v1
4646 with :
4747 username : ${{ secrets.DOCKERHUB_USERNAME }}
5252 run : |-
5353 docker push $IMAGE_NAME:latest
5454
55+ - name : Set tag in environment
56+ if : contains(github.ref, 'refs/tags/')
57+ run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
58+
5559 - name : Push tagged image
56- if : contains(github.ref, 'refs/tags/v ')
60+ if : contains(github.ref, 'refs/tags/')
5761 run : |-
58- docker push $IMAGE_NAME:$GITHUB_TAG
62+ docker tag $IMAGE_NAME:${{ github.sha }} $IMAGE_NAME:$RELEASE_VERSION
63+ docker push $IMAGE_NAME:$RELEASE_VERSION
You can’t perform that action at this time.
0 commit comments