File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 16
16
run : make
17
17
- name : Golang Test
18
18
run : make test
19
+ - name : Get the version
20
+ id : get_version
21
+ run : |
22
+ # Version is based on a semantic version tag
23
+ VERSION=${GITHUB_REF#refs/tags/}
24
+ # Publish to latest, minor, and patch tags
25
+ TAGS=('latest')
26
+ # Add Tag is Exists
27
+ if [ "$VERSION" != "$GITHUB_REF" ]; then
28
+ TAGS=('latest' "${VERSION}")
29
+ fi
30
+ # Set IMAGE_TAGS output for use in next step
31
+ ( IFS=$','; echo "::set-output name=IMAGE_TAGS::${TAGS[*]}" )
19
32
- name : " Build and Push Image"
20
33
uses : docker/build-push-action@v1
21
34
with :
24
37
password : ${{ secrets.OPERATOR_REGISTRY_PASSWORD }}
25
38
registry : ${{ secrets.OPERATOR_REGISTRY_SERVER }}
26
39
repository : ${{ secrets.OPERATOR_REGISTRY_REPOSITORY }}
27
- push : ${{ github.ref == 'refs/heads/master' && secrets.OPERATOR_REGISTRY_PUSH == 'true' }}
28
- tags : latest
40
+ push : ${{ ( github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && secrets.OPERATOR_REGISTRY_PUSH == 'true' }}
41
+ tags : " ${{ steps.get_version.outputs.IMAGE_TAGS }} "
You can’t perform that action at this time.
0 commit comments