@@ -2,13 +2,18 @@ name: Build sandbox image
22
33on :
44 push :
5- branches : [main]
5+ branches : [main, init ]
66 paths :
77 - " docker/**"
88 - " .github/workflows/build-image.yml"
99 repository_dispatch :
1010 types : [code-repo-updated]
1111 workflow_dispatch :
12+ inputs :
13+ code_ref :
14+ description : " Ref of workshop-nexus-intro-code to build against (branch, tag, or sha)"
15+ required : false
16+ default : " init"
1217
1318jobs :
1419 build :
@@ -21,24 +26,33 @@ jobs:
2126 steps :
2227 - uses : actions/checkout@v4
2328
24- - name : Checkout workshop-nexus-intro-code (private)
29+ - name : Checkout workshop-nexus-intro-code
2530 uses : actions/checkout@v4
2631 with :
2732 repository : temporalio/workshop-nexus-intro-code
28- token : ${{ secrets.WORKSHOP_CODE_PAT }}
2933 path : workshop-nexus-intro-code
34+ ref : ${{ github.event.inputs.code_ref || (github.ref_name == 'main' && 'main' || 'init') }}
3035
3136 - uses : docker/login-action@v3
3237 with :
3338 registry : ghcr.io
3439 username : ${{ github.actor }}
3540 password : ${{ secrets.GITHUB_TOKEN }}
3641
42+ - name : Compute image tags
43+ id : tags
44+ run : |
45+ if [ "${{ github.ref_name }}" = "main" ]; then
46+ echo "extra=${{ env.IMAGE }}:latest" >> "$GITHUB_OUTPUT"
47+ else
48+ echo "extra=${{ env.IMAGE }}:${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
49+ fi
50+
3751 - uses : docker/build-push-action@v6
3852 with :
3953 context : .
4054 file : docker/Dockerfile
4155 push : true
4256 tags : |
43- ${{ env.IMAGE }}:latest
57+ ${{ steps.tags.outputs.extra }}
4458 ${{ env.IMAGE }}:${{ github.sha }}
0 commit comments