11name : Docker image
22
3- # Builds and publishes the public Buzz relay images as ghcr.io/block/buzz.
3+ # Builds and publishes the public Buzz relay images as ghcr.io/<owner>/<repo>
4+ # (ghcr.io/block/buzz upstream) plus the matching -push-gateway image.
45# Normal tags contain stripped binaries; matching debug-* tags contain the same
56# optimized binaries with line-table debug information for native profilers.
67#
@@ -77,10 +78,11 @@ concurrency:
7778permissions : {}
7879
7980env :
80- # Single source of truth for the image name. Set GHCR_IMAGE as a repo
81- # variable to override (e.g., for forks that want to push to their own
82- # namespace without forking this file).
83- IMAGE_NAME : ${{ vars.GHCR_IMAGE != '' && vars.GHCR_IMAGE || 'ghcr.io/block/buzz' }}
81+ # Single source of truth for the image names. Both default to the running
82+ # repository's namespace, so forks publish (and cache) in their own registry.
83+ # Set GHCR_IMAGE / GHCR_PUSH_GATEWAY_IMAGE as repo variables to override.
84+ IMAGE_NAME : ${{ vars.GHCR_IMAGE != '' && vars.GHCR_IMAGE || format('ghcr.io/{0}', github.repository) }}
85+ PUSH_GATEWAY_IMAGE : ${{ vars.GHCR_PUSH_GATEWAY_IMAGE != '' && vars.GHCR_PUSH_GATEWAY_IMAGE || format('ghcr.io/{0}-push-gateway', github.repository) }}
8486
8587jobs :
8688 build :
@@ -104,6 +106,11 @@ jobs:
104106 arch : arm64
105107
106108 steps :
109+ - name : Normalize image names
110+ shell : bash
111+ run : |
112+ printf 'IMAGE_NAME=%s\nPUSH_GATEWAY_IMAGE=%s\n' "${IMAGE_NAME,,}" "${PUSH_GATEWAY_IMAGE,,}" >> "$GITHUB_ENV"
113+
107114 - name : Checkout
108115 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
109116 with :
@@ -330,6 +337,11 @@ jobs:
330337 tag_prefix : debug-
331338
332339 steps :
340+ - name : Normalize image names
341+ shell : bash
342+ run : |
343+ printf 'IMAGE_NAME=%s\nPUSH_GATEWAY_IMAGE=%s\n' "${IMAGE_NAME,,}" "${PUSH_GATEWAY_IMAGE,,}" >> "$GITHUB_ENV"
344+
333345 - name : Checkout source
334346 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
335347 with :
@@ -414,7 +426,7 @@ jobs:
414426
415427 - name : Attest provenance for the merged image
416428 # Sigstore-signed in-toto attestation, verifiable with:
417- # gh attestation verify oci://ghcr.io/block/buzz :<tag> --owner block
429+ # gh attestation verify oci://<IMAGE_NAME> :<tag> --owner <repository owner>
418430 uses : actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
419431 with :
420432 subject-name : ${{ env.IMAGE_NAME }}
@@ -481,13 +493,13 @@ jobs:
481493 echo
482494 echo "Verify provenance:"
483495 echo '```'
484- echo " gh attestation verify oci://${IMAGE_NAME}@${MERGED_DIGEST} --owner block "
496+ printf ' gh attestation verify oci://%s@%s --owner %s\n' "$IMAGE_NAME" "$MERGED_DIGEST" "$GITHUB_REPOSITORY_OWNER "
485497 echo '```'
486498 if [[ "$VARIANT" == "release" ]]; then
487499 echo
488500 echo "Verify deployment eligibility:"
489501 echo '```'
490- echo " gh attestation verify oci://${IMAGE_NAME}@${MERGED_DIGEST} --repo block/buzz --signer-workflow block/buzz/ .github/workflows/docker.yml --predicate-type https://buzz.block.xyz/attestations/deployment-eligibility/v1 --source-digest ${ SOURCE_SHA} "
502+ printf ' gh attestation verify oci://%s@%s --repo %s --signer-workflow %s/ .github/workflows/docker.yml --predicate-type https://buzz.block.xyz/attestations/deployment-eligibility/v1 --source-digest %s\n' "$IMAGE_NAME" "$MERGED_DIGEST" "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY" "$ SOURCE_SHA"
491503 echo '```'
492504 fi
493505 } >> "$GITHUB_STEP_SUMMARY"
@@ -510,6 +522,11 @@ jobs:
510522 runner : ubuntu-24.04-arm
511523 arch : arm64
512524 steps :
525+ - name : Normalize image names
526+ shell : bash
527+ run : |
528+ printf 'IMAGE_NAME=%s\nPUSH_GATEWAY_IMAGE=%s\n' "${IMAGE_NAME,,}" "${PUSH_GATEWAY_IMAGE,,}" >> "$GITHUB_ENV"
529+
513530 - name : Checkout
514531 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
515532 with :
@@ -539,7 +556,7 @@ jobs:
539556 id : meta
540557 uses : docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
541558 with :
542- images : ghcr.io/block/buzz-push-gateway
559+ images : ${{ env.PUSH_GATEWAY_IMAGE }}
543560 labels : |
544561 org.opencontainers.image.title=Buzz Push Gateway
545562 org.opencontainers.image.description=Capability-gated APNs last hop for Buzz
@@ -552,9 +569,9 @@ jobs:
552569 file : ./Dockerfile.push-gateway
553570 platforms : ${{ matrix.platform }}
554571 labels : ${{ steps.meta.outputs.labels }}
555- outputs : type=image,name=ghcr.io/block/buzz-push-gateway ,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
556- cache-from : type=registry,ref=ghcr.io/block/buzz-push-gateway -buildcache:${{ matrix.arch }}
557- 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) || '' }}
572+ outputs : type=image,name=${{ env.PUSH_GATEWAY_IMAGE }} ,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
573+ cache-from : type=registry,ref=${{ env.PUSH_GATEWAY_IMAGE }} -buildcache:${{ matrix.arch }}
574+ cache-to : ${{ (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.PUSH_GATEWAY_IMAGE , matrix.arch) || '' }}
558575 - name : Export digest
559576 if : github.event_name != 'pull_request'
560577 env :
@@ -614,6 +631,11 @@ jobs:
614631 id-token : write
615632 attestations : write
616633 steps :
634+ - name : Normalize image names
635+ shell : bash
636+ run : |
637+ printf 'IMAGE_NAME=%s\nPUSH_GATEWAY_IMAGE=%s\n' "${IMAGE_NAME,,}" "${PUSH_GATEWAY_IMAGE,,}" >> "$GITHUB_ENV"
638+
617639 - name : Download per-arch digests
618640 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
619641 with :
@@ -632,7 +654,7 @@ jobs:
632654 id : meta
633655 uses : docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
634656 with :
635- images : ghcr.io/block/buzz-push-gateway
657+ images : ${{ env.PUSH_GATEWAY_IMAGE }}
636658 tags : |
637659 type=ref,event=branch,enable=${{ github.event_name != 'workflow_dispatch' || inputs.version == '' }}
638660 type=sha,prefix=sha-,format=short,enable=${{ github.event_name != 'workflow_dispatch' || inputs.version == '' }}
@@ -646,15 +668,15 @@ jobs:
646668 run : |
647669 set -euo pipefail
648670 tags=(); while IFS= read -r tag; do [ -n "$tag" ] && tags+=("-t" "$tag"); done <<< "$META_TAGS"
649- digests=(); for digest in *; do digests+=("ghcr.io/block/buzz-push-gateway @sha256:${digest}"); done
671+ digests=(); for digest in *; do digests+=("${PUSH_GATEWAY_IMAGE} @sha256:${digest}"); done
650672 docker buildx imagetools create "${tags[@]}" "${digests[@]}"
651673 first_tag=$(echo "$META_TAGS" | head -n1)
652674 digest=$(docker buildx imagetools inspect "$first_tag" --format '{{json .Manifest}}' | jq -r '.digest')
653675 echo "digest=${digest}" >> "$GITHUB_OUTPUT"
654676 - name : Attest gateway image provenance
655677 uses : actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
656678 with :
657- subject-name : ghcr.io/block/buzz-push-gateway
679+ subject-name : ${{ env.PUSH_GATEWAY_IMAGE }}
658680 subject-digest : ${{ steps.manifest.outputs.digest }}
659681 push-to-registry : true
660682 - name : Gateway publication summary
@@ -664,7 +686,7 @@ jobs:
664686 run : |
665687 set -euo pipefail
666688 {
667- echo "### Published \`ghcr.io/block/buzz-push-gateway \`"
689+ echo "### Published \`${PUSH_GATEWAY_IMAGE} \`"
668690 echo
669691 printf "**Digest:** \`%s\`\n" "$GATEWAY_DIGEST"
670692 echo
@@ -675,6 +697,6 @@ jobs:
675697 echo
676698 echo 'Verify provenance before deployment:'
677699 echo "\`\`\`"
678- printf 'gh attestation verify oci://ghcr.io/block/buzz-push-gateway @%s --owner block \n' "$GATEWAY_DIGEST"
700+ printf 'gh attestation verify oci://%s @%s --owner %s \n' "$PUSH_GATEWAY_IMAGE" "$ GATEWAY_DIGEST" "$GITHUB_REPOSITORY_OWNER "
679701 echo "\`\`\`"
680702 } >> "$GITHUB_STEP_SUMMARY"
0 commit comments