11name : Publish
22
33on :
4- push :
5- tags :
6- - v*
4+ workflow_dispatch :
5+ inputs :
6+ image_tag :
7+ description : ' Image tag'
8+ required : true
9+ default : ' latest'
710
811env :
912 IMAGE_NAME : openvpn-client
@@ -16,21 +19,35 @@ jobs:
1619 - name : Check out repository
1720 uses : actions/checkout@v2
1821
19- - name : Get the version
20- id : get_version
21- run : echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
22-
2322 - name : Log in to registry
2423 uses : docker/login-action@v1
2524 with :
2625 registry : ghcr.io
2726 username : ${{ github.repository_owner }}
2827 password : ${{ secrets.GITHUB_TOKEN }}
2928
29+ - name : Create tags
30+ id : tags
31+ run : |
32+ vpatch=${{ github.event.inputs.image_tag }}
33+ echo ::set-output name=vpatch::$vpatch
34+ echo ::set-output name=vminor::${vpatch%.*}
35+ echo ::set-output name=vmajor::${vpatch%%.*}
36+
37+ patch=${${{ github.event.inputs.image_tag }}#v}
38+ echo ::set-output name=patch::$patch
39+ echo ::set-output name=minor::${patch%.*}
40+ echo ::set-output name=major::${patch%%.*}
41+
3042 - name : Build and push
3143 uses : docker/build-push-action@v2
3244 with :
3345 tags : |
34- ghcr.io/wfg/openvpn-client:${{ steps.get_version.outputs.VERSION }}
46+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.vpatch }}
47+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.vminor }}
48+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.vmajor }}
49+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.patch }}
50+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.minor }}
51+ ghcr.io/wfg/openvpn-client:${{ steps.tags.outputs.major }}
3552 ghcr.io/wfg/openvpn-client:latest
3653 push : true
0 commit comments