Skip to content

Commit 3dcbdb8

Browse files
feat(ci): attest build provenance (#161)
## Estate attestation rollout Adds GitHub native build-provenance attestation to `.github/workflows/ghcr-publish.yml`. **Push mechanism:** Podman (`podman build` + `podman push` to ghcr.io), image `ghcr.io/hyperpolymath/verisimdb-api`. **How the digest is obtained:** the SHA-tagged GHCR push now runs with `podman push --digestfile=/tmp/ghcr-digest`, which writes the real `sha256:...` digest of the pushed manifest. That value is exported as the `push` step output and fed to the attestation as `subject-digest`. **Changes:** - Added a job `permissions` block with `id-token: write` + `attestations: write` (plus the existing `contents: read`, `packages: write`). - Captured the pushed digest via `--digestfile`. - Added an `actions/attest-build-provenance@e8998f94…` (v2, pinned) step with `push-to-registry: true`, gated on the same non-PR condition as the push. Verify with: ``` gh attest verify oci://ghcr.io/hyperpolymath/verisimdb-api:<tag> --repo hyperpolymath/verisimdb ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5264f9c commit 3dcbdb8

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/ghcr-publish.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
build-and-push:
3131
runs-on: ubuntu-latest
3232
timeout-minutes: 60
33+
permissions:
34+
contents: read
35+
packages: write
36+
id-token: write # mint the OIDC token the attestation is signed with
37+
attestations: write # write the build-provenance attestation (the "claim")
3338
steps:
3439
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3540

@@ -55,10 +60,26 @@ jobs:
5560
podman rm -f verisim-smoke
5661
5762
- name: Push to GHCR
63+
id: push
5864
if: github.event_name != 'pull_request'
5965
run: |
6066
SHORT_SHA="${GITHUB_SHA::12}"
6167
echo "${{ secrets.GITHUB_TOKEN }}" \
6268
| podman login ghcr.io -u "${{ github.actor }}" --password-stdin
69+
# --digestfile records the real sha256 of the pushed manifest so the
70+
# attestation binds to exactly what the registry received.
71+
podman push --digestfile=/tmp/ghcr-digest "$IMAGE:$SHORT_SHA"
6372
podman push "$IMAGE:latest"
64-
podman push "$IMAGE:$SHORT_SHA"
73+
echo "digest=$(cat /tmp/ghcr-digest)" >> "$GITHUB_OUTPUT"
74+
75+
# GitHub native artifact attestation (build provenance) for the pushed
76+
# image. Verify with:
77+
# gh attest verify oci://ghcr.io/hyperpolymath/verisimdb-api:<tag> \
78+
# --repo ${{ github.repository }}
79+
- name: Attest container provenance
80+
if: github.event_name != 'pull_request'
81+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2
82+
with:
83+
subject-name: ghcr.io/hyperpolymath/verisimdb-api
84+
subject-digest: ${{ steps.push.outputs.digest }}
85+
push-to-registry: true

0 commit comments

Comments
 (0)