3333
3434 image :
3535 needs : build
36- # only on tags and dev branch
37- if : startsWith(github.ref, 'refs/tags/v ') || github.ref == 'refs/heads/dev'
36+ # only on main and dev branch
37+ if : startsWith(github.ref, 'refs/heads/main ') || github.ref == 'refs/heads/dev'
3838 runs-on : ubuntu-latest
3939 steps :
4040 - name : Check out code
@@ -55,29 +55,29 @@ jobs:
5555 run : |
5656 baseRef="${GITHUB_REF#*/}"
5757 imageTag="${baseRef#*/}"
58+ if [ "$imageTag" = "main" ] ; then
59+ imageTag="latest"
60+ fi
5861 echo "::set-output name=tag::$imageTag"
5962 echo "::set-output name=repo::ghcr.io/${{ github.repository }}"
60- - name : Push Image Tag
63+ - name : Push Dev Tag
64+ if : startsWith(github.ref, 'refs/heads/dev')
6165 run : |
6266 docker tag repo ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }}
6367 docker push ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }}
68+ - name : Extract version
69+ if : startsWith(github.ref, 'refs/heads/main')
70+ id : extract_version
71+ run : node -pe "'::set-output name=version::' + require('./package.json').version"
72+ - name : Push Version Tag Tag
73+ if : startsWith(github.ref, 'refs/heads/main')
74+ run : |
75+ docker tag repo ${{ steps.tagname.outputs.repo }}:v{{ steps.extract_version.outputs.version }}
76+ docker push ${{ steps.tagname.outputs.repo }}:v{{ steps.extract_version.outputs.version }}
6477 - name : Trigger Webhook
6578 run : |
6679 # trigger a webhook update
6780 curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
6881 -X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
6982 -H "Content-Type: application/x-www-form-urlencoded" \
7083 -d "repository=${{ steps.tagname.outputs.repo }}&tag=${{ steps.tagname.outputs.tag }}"
71- - name : Push Latest Tag
72- if : startsWith(github.ref, 'refs/tags/v')
73- run : |
74- docker tag repo ${{ steps.tagname.outputs.repo }}:latest
75- docker push ${{ steps.tagname.outputs.repo }}:latest
76- - name : Trigger Latest Webhook
77- if : startsWith(github.ref, 'refs/tags/v')
78- run : |
79- # trigger a webhook update
80- curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
81- -X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
82- -H "Content-Type: application/x-www-form-urlencoded" \
83- -d "repository=${{ steps.tagname.outputs.repo }}&tag=latest"
0 commit comments