File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change 55 branches :
66 - main
77 workflow_dispatch :
8+ inputs :
9+ prerelease :
10+ description : " Generate prerelease build with branch name and snapshot tags"
11+ required : false
12+ default : false
13+ type : boolean
814
915env :
1016 TAG_NAME : latest
@@ -33,10 +39,14 @@ jobs:
3339 password : ${{ github.token }}
3440
3541 - name : Add SHORT_SHA env property with commit short sha
36- run : echo "SHORT_SHA=${ GITHUB_SHA::8} " >> $GITHUB_ENV
42+ run : echo "SHORT_SHA=$(echo $ GITHUB_SHA | cut -c1-8) " >> $GITHUB_ENV
3743
38- - name : Build and push Docker image
44+ - name : Add BRANCH_NAME env property with branch name
45+ run : echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
46+
47+ - name : Build and push Docker image (release)
3948 uses : docker/build-push-action@v5
49+ if : ${{ inputs.prerelease == 'false' }}
4050 with :
4151 context : .
4252 file : ./${{ matrix.app }}/Dockerfile
4757 cache-from : type=gha
4858 cache-to : type=gha,mode=max
4959 platforms : linux/amd64
60+
61+ - name : Build and push Docker image (prerelease)
62+ uses : docker/build-push-action@v5
63+ if : ${{ inputs.prerelease == 'true' }}
64+ with :
65+ context : .
66+ file : ./${{ matrix.app }}/Dockerfile
67+ push : true
68+ tags : |
69+ ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:${{ env.BRANCH_NAME }}
70+ ghcr.io/${{ github.repository_owner }}/auto-drive-${{ matrix.app }}:snapshot-${{ env.SHORT_SHA }}
71+ cache-from : type=gha
72+ cache-to : type=gha,mode=max
73+ platforms : linux/amd64
You can’t perform that action at this time.
0 commit comments