Skip to content

Commit bb46e50

Browse files
feat(ci): attest build provenance (#31)
## Summary Adds GitHub-native build-provenance attestation (`actions/attest-build-provenance@e8998f94…` # v2, SHA-pinned) to `.github/workflows/ci.yml`, mirroring the estate's proven exemplar. ## Attested artifacts - **Container image** (`docker` job): attests the pushed GHCR image by `subject-digest` (`steps.push.outputs.digest`), with `push-to-registry: true`. Gated on `github.event_name == 'push'` so it does not run with an empty digest when nothing was pushed. Added a job-level `permissions:` block (`contents: read`, `packages: write`, `id-token: write`, `attestations: write`) and `id: push` to the Build-and-push step. - **Release binaries** (`release` job): attests `dist/*` (the downloaded build artifacts) via `subject-path`. Added `id-token: write` + `attestations: write` to the existing `permissions:` (kept `contents: write`). ## Validation - `python3 -c "import yaml; yaml.safe_load(...)"` passes. - Commit is SSH-signed (verified). Do not merge without owner review.
1 parent 0fccbc5 commit bb46e50

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ jobs:
244244
timeout-minutes: 15
245245
needs: [detect, build]
246246
if: needs.detect.outputs.has_docker == 'true'
247+
permissions:
248+
contents: read
249+
packages: write
250+
id-token: write
251+
attestations: write
247252
steps:
248253
- name: Checkout
249254
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -268,6 +273,7 @@ jobs:
268273
type=semver,pattern={{major}}.{{minor}}
269274
type=sha
270275
- name: Build and push
276+
id: push
271277
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
272278
with:
273279
context: .
@@ -276,6 +282,13 @@ jobs:
276282
labels: ${{ steps.meta.outputs.labels }}
277283
cache-from: type=gha
278284
cache-to: type=gha,mode=max
285+
- name: Attest container provenance
286+
if: github.event_name == 'push'
287+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2
288+
with:
289+
subject-name: ghcr.io/${{ github.repository }}
290+
subject-digest: ${{ steps.push.outputs.digest }}
291+
push-to-registry: true
279292
# Release job (on tags)
280293
release:
281294
name: Release
@@ -285,6 +298,8 @@ jobs:
285298
if: startsWith(github.ref, 'refs/tags/v')
286299
permissions:
287300
contents: write
301+
id-token: write
302+
attestations: write
288303
steps:
289304
- name: Checkout
290305
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -298,3 +313,7 @@ jobs:
298313
with:
299314
generate_release_notes: true
300315
files: dist/*
316+
- name: Attest build provenance
317+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2
318+
with:
319+
subject-path: 'dist/*'

0 commit comments

Comments
 (0)