1- # Build computerd images from commits that passed CI. The mutable :main tag
2- # follows main, while :next follows the changesets Version Packages branch.
1+ # Build the computerd image from the commit that passed CI on the release
2+ # branch. The mutable :next tag lets release candidates use the versioned
3+ # package and matching daemon before publication.
34
4- name : Computerd branch image
5+ name : Next computerd image
56
67on :
78 workflow_run :
89 workflows : ["CI"]
9- branches : [main, release]
10+ branches : [release]
1011 types : [completed]
1112 workflow_dispatch : {}
1213
1314concurrency :
14- # Keep the main and next publishers independent while allowing newer commits
15- # on either branch to cancel stale image builds for the same tag.
16- group : ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
15+ # Only the newest release commit may publish the mutable :next tag.
16+ group : ${{ github.workflow }}
1717 cancel-in-progress : true
1818
1919permissions :
@@ -33,18 +33,12 @@ jobs:
3333 github.event.workflow_run.event == 'push' ||
3434 github.event.workflow_run.event == 'workflow_dispatch'
3535 ) &&
36- (
37- github.event.workflow_run.head_branch == 'main' ||
38- github.event.workflow_run.head_branch == 'release'
39- ) &&
36+ github.event.workflow_run.head_branch == 'release' &&
4037 github.event.workflow_run.head_repository.full_name == github.repository
4138 ) ||
4239 (
4340 github.event_name == 'workflow_dispatch' &&
44- (
45- github.ref == 'refs/heads/main' ||
46- github.ref == 'refs/heads/release'
47- )
41+ github.ref == 'refs/heads/release'
4842 )
4943 )
5044 }}
5852 ref : ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.ref }}
5953 fetch-depth : 1
6054
61- - name : Select the mutable image tag
62- id : image
63- env :
64- SOURCE_BRANCH : ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref_name }}
65- run : |
66- case "$SOURCE_BRANCH" in
67- main)
68- tag=main
69- ;;
70- release)
71- tag=next
72- ;;
73- *)
74- echo "Unsupported source branch: $SOURCE_BRANCH" >&2
75- exit 1
76- ;;
77- esac
78- echo "branch=$SOURCE_BRANCH" >> "$GITHUB_OUTPUT"
79- echo "tag=$tag" >> "$GITHUB_OUTPUT"
80-
8155 - uses : ./.github/actions/install
8256
8357 - name : Install system dependencies
@@ -118,29 +92,25 @@ jobs:
11892 password : ${{ secrets.GITHUB_TOKEN }}
11993
12094 # A slower CI run for an older commit can finish after a newer one. Do
121- # not let that run replace the newer branch image.
122- - name : Verify the source branch has not advanced
123- id : branch-sha
124- env :
125- SOURCE_BRANCH : ${{ steps.image.outputs.branch }}
95+ # not let that run replace the newer release image.
96+ - name : Verify the release branch has not advanced
97+ id : release-sha
12698 run : |
127- git fetch --no-tags --depth=1 origin "$SOURCE_BRANCH"
99+ git fetch --no-tags --depth=1 origin release
128100 if [[ "$(git rev-parse HEAD)" != "$(git rev-parse FETCH_HEAD)" ]]; then
129- echo "$SOURCE_BRANCH advanced while this image was building; skipping the push"
101+ echo "release advanced while this image was building; skipping the push"
130102 echo "current=false" >> "$GITHUB_OUTPUT"
131103 else
132104 echo "current=true" >> "$GITHUB_OUTPUT"
133105 fi
134106
135- - name : Build and push the branch image
136- if : steps.branch-sha.outputs.current == 'true'
137- env :
138- IMAGE_TAG : ${{ steps.image.outputs.tag }}
107+ - name : Build and push the next image
108+ if : steps.release-sha.outputs.current == 'true'
139109 run : |
140110 docker buildx build \
141111 --platform linux/amd64 \
142112 --push \
143113 --provenance=false \
144- --tag " ghcr.io/cloudflare/computer-computerd-linux-x64:$IMAGE_TAG" \
114+ --tag ghcr.io/cloudflare/computer-computerd-linux-x64:next \
145115 --file packages/computer-computerd-linux-x64/Dockerfile \
146116 packages/computer-computerd-linux-x64
0 commit comments