@@ -16,14 +16,24 @@ name: Docker image
1616# the relay image version tracks crates/buzz-relay/Cargo.toml, never desktop.
1717#
1818# Triggers:
19- # - push to main → :main + :sha-<7>
20- # + :debug- main + :debug- sha-<7>
19+ # - push to main → build both images, publish nothing
20+ # (was : main/: sha-<7> — see PUBLISH GATE below)
2121# - push tags relay-v*.*.* → :{version} + :{major}.{minor} + :{major}
2222# + matching :debug-* tags
2323# (+ :latest/:debug-latest for stable releases)
2424# - pull_request → build only (no push), cache stays warm
2525# - workflow_dispatch → manual relay-tag rescue at the tag itself
2626#
27+ # PUBLISH GATE (5dive fork): every write to the registry — the image push, the
28+ # buildcache export, the merged manifest and its attestation — fires only on a
29+ # `relay-v*` tag push or a rescue `workflow_dispatch`, never on a `main` push or
30+ # a PR. Same shape as helm-chart.yml's publish job. `main` pushes and PRs still
31+ # build both images on both arches, so the compile signal is intact; they just
32+ # cannot write to IMAGE_NAME's namespace, which on this fork defaults to
33+ # upstream `ghcr.io/block/*` and is not ours to write to. This makes the
34+ # namespace boundary a control in the workflow rather than an accident of which
35+ # credentials happen to be missing.
36+ #
2737# Why workflow_dispatch carries a version input:
2838# Normal releases arrive through the push:tags trigger above. The input is
2939# retained only for an operator to rerun publication manually at an immutable
@@ -175,11 +185,11 @@ jobs:
175185 # Push by digest, not by tag — the merge job assembles the tags
176186 # into one multi-arch manifest. This is what makes the native-arm
177187 # matrix possible.
178- outputs : type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request ' }}
188+ outputs : type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.ref_type == 'tag' || github. event_name == 'workflow_dispatch ' }}
179189 cache-from : |
180190 type=registry,ref=${{ env.IMAGE_NAME }}-buildcache:${{ matrix.arch }}
181191 cache-to : |
182- ${{ (github.event_name != 'pull_request ' || github.event.pull_request.head.repo.full_name == github.repository ) && format('type=registry,ref={0}-buildcache:{1},mode=max,compression=zstd', env.IMAGE_NAME, matrix.arch) || '' }}
192+ ${{ (github.ref_type == 'tag ' || github.event_name == 'workflow_dispatch' ) && format('type=registry,ref={0}-buildcache:{1},mode=max,compression=zstd', env.IMAGE_NAME, matrix.arch) || '' }}
183193
184194 - name : Build and push debug image by digest
185195 id : build-debug
@@ -190,12 +200,12 @@ jobs:
190200 target : runtime-debug
191201 platforms : ${{ matrix.platform }}
192202 labels : ${{ steps.meta.outputs.labels }}
193- outputs : type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request ' }}
203+ outputs : type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.ref_type == 'tag' || github. event_name == 'workflow_dispatch ' }}
194204 cache-from : |
195205 type=registry,ref=${{ env.IMAGE_NAME }}-buildcache:${{ matrix.arch }}
196206
197207 - name : Export release and debug digests
198- if : github.event_name != 'pull_request '
208+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
199209 env :
200210 RELEASE_DIGEST : ${{ steps.build-release.outputs.digest }}
201211 DEBUG_DIGEST : ${{ steps.build-debug.outputs.digest }}
@@ -205,7 +215,7 @@ jobs:
205215 touch "/tmp/digests-debug/${DEBUG_DIGEST#sha256:}"
206216
207217 - name : Upload release digest
208- if : github.event_name != 'pull_request '
218+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
209219 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
210220 with :
211221 name : digests-release-${{ matrix.arch }}
@@ -214,7 +224,7 @@ jobs:
214224 retention-days : 1
215225
216226 - name : Upload debug digest
217- if : github.event_name != 'pull_request '
227+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
218228 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
219229 with :
220230 name : digests-debug-${{ matrix.arch }}
@@ -224,7 +234,7 @@ jobs:
224234
225235 merge :
226236 name : Merge ${{ matrix.variant }} multi-arch manifest
227- if : github.event_name != 'pull_request '
237+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
228238 runs-on : ubuntu-24.04
229239 needs : build
230240 timeout-minutes : 15
@@ -400,16 +410,16 @@ jobs:
400410 file : ./Dockerfile.push-gateway
401411 platforms : ${{ matrix.platform }}
402412 labels : ${{ steps.meta.outputs.labels }}
403- outputs : type=image,name=ghcr.io/block/buzz-push-gateway,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request ' }}
413+ outputs : type=image,name=ghcr.io/block/buzz-push-gateway,push-by-digest=true,name-canonical=true,push=${{ github.ref_type == 'tag' || github. event_name == 'workflow_dispatch ' }}
404414 cache-from : type=registry,ref=ghcr.io/block/buzz-push-gateway-buildcache:${{ matrix.arch }}
405- cache-to : ${{ (github.event_name != 'pull_request ' || github.event.pull_request.head.repo.full_name == github.repository ) && format('type=registry,ref=ghcr.io/block/buzz-push-gateway-buildcache:{0},mode=max,compression=zstd', matrix.arch) || '' }}
415+ cache-to : ${{ (github.ref_type == 'tag ' || github.event_name == 'workflow_dispatch' ) && format('type=registry,ref=ghcr.io/block/buzz-push-gateway-buildcache:{0},mode=max,compression=zstd', matrix.arch) || '' }}
406416 - name : Export digest
407- if : github.event_name != 'pull_request '
417+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
408418 env :
409419 DIGEST : ${{ steps.build.outputs.digest }}
410420 run : mkdir -p /tmp/gateway-digests && touch "/tmp/gateway-digests/${DIGEST#sha256:}"
411421 - name : Upload digest
412- if : github.event_name != 'pull_request '
422+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
413423 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
414424 with :
415425 name : gateway-digests-${{ matrix.arch }}
@@ -419,7 +429,7 @@ jobs:
419429
420430 push-gateway-merge :
421431 name : Publish public push gateway image
422- if : github.event_name != 'pull_request '
432+ if : github.ref_type == 'tag' || github. event_name == 'workflow_dispatch '
423433 runs-on : ubuntu-24.04
424434 needs : push-gateway-build
425435 timeout-minutes : 15
0 commit comments