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
3
3
on :
4
4
push :
5
5
branches : [ master ]
6
+ tags : ['*']
6
7
pull_request :
7
8
8
9
env :
41
42
sarif_file : ' trivy-results.sarif'
42
43
43
44
- name : Login to Docker Hub
44
- if : github.ref == 'refs/heads/master' && github.event_name == 'push'
45
45
uses : docker/login-action@v1
46
46
with :
47
47
username : ${{ secrets.DOCKERHUB_USERNAME }}
52
52
run : |-
53
53
docker push $IMAGE_NAME:latest
54
54
55
+ - name : Set tag in environment
56
+ if : contains(github.ref, 'refs/tags/')
57
+ run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
58
+
55
59
- name : Push tagged image
56
- if : contains(github.ref, 'refs/tags/v ')
60
+ if : contains(github.ref, 'refs/tags/')
57
61
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