@@ -24,31 +24,44 @@ jobs:
24
24
test :
25
25
name : Testing
26
26
runs-on : ubuntu-latest
27
+ outputs :
28
+ tag : ${{ steps.info.outputs.tag }}
27
29
steps :
28
30
- name : Checkout Code
29
31
uses : actions/checkout@v2
32
+ - id : info
33
+ run : |
34
+ repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
35
+ if [ -n $GITHUB_SHA ]
36
+ then
37
+ tag=$GITHUB_SHA
38
+ elif [ -n $GITHUB_HEAD_REF ]
39
+ then
40
+ tag=$(echo $GITHUB_HEAD_REF | cut -f 3- -d "/")
41
+ else
42
+ tag=schedule
43
+ fi
44
+ tag=$tag
45
+ echo "::set-output name=repo::$repo"
46
+ echo "::set-output name=tag::$tag"
30
47
- name : Build and Push to GitHub registry Commit tag
31
48
uses : elgohr/Publish-Docker-Github-Action@master
32
49
with :
33
50
name : docker.pkg.github.com/${{ github.repository }}/jelastic-cli
34
51
username : ${{ github.repository_owner }}
35
52
password : ${{ secrets.G_TOKEN }}
36
53
registry : docker.pkg.github.com
37
- tags : " ${{ github.sha }}"
54
+ tags : " ${{ steps.info.outputs.tag }}"
38
55
- name : Login to GitHub Packages Docker Registry
39
56
uses : docker/login-action@v1
40
57
with :
41
58
registry : docker.pkg.github.com
42
59
username : ${{ github.repository_owner }}
43
60
password : ${{ secrets.G_TOKEN }}
44
- - id : repo
45
- run : |
46
- lower=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
47
- echo "::set-output name=lower::$lower"
48
61
- name : Anchore scan
49
62
uses : anchore/scan-action@v2
50
63
with :
51
- image : " docker.pkg.github.com/${{ steps.repo .outputs.lower }}/jelastic-cli:${{ github.sha }}"
64
+ image : " docker.pkg.github.com/${{ steps.info .outputs.repo }}/jelastic-cli:${{ steps.info.outputs.tag }}"
52
65
fail-build : true
53
66
acs-report-enable : true
54
67
severity-cutoff : high
@@ -78,14 +91,14 @@ jobs:
78
91
username : ${{ github.repository_owner }}
79
92
password : ${{ secrets.G_TOKEN }}
80
93
registry : docker.pkg.github.com
81
- tags : " ${{ steps.create_tag_test.outputs.new_tag }},latest"
94
+ tags : " ${{ needs.test.outputs.tag }},${{ steps.create_tag_test.outputs.new_tag }},latest"
82
95
- name : Build and Push to DockerHub
83
96
uses : elgohr/Publish-Docker-Github-Action@master
84
97
with :
85
98
name : aliaksandrdounar/jelastic-cli
86
99
username : ${{ secrets.DOCKER_USERNAME }}
87
100
password : ${{ secrets.DOCKER_PASSWORD }}
88
- tags : " ${{ github.sha }},${{ steps.create_tag_test.outputs.new_tag }},latest"
101
+ tags : " ${{ needs.test.outputs.tag }},${{ steps.create_tag_test.outputs.new_tag }},latest"
89
102
90
103
release :
91
104
name : Create Release
0 commit comments