Skip to content

Commit dbca904

Browse files
authored
Add GitHub artifact attestations to release workflow (#1494)
Closes #1493 Adds [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) to the release workflow so consumers can verify artifacts were built by CI: ```bash gh attestation verify <artifact> --repo j178/prek ``` GitHub already generates release attestations that verify file integrity (checksums), but build provenance additionally proves the artifacts were produced by the CI workflow rather than uploaded manually.
1 parent 7640685 commit dbca904

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ jobs:
277277
# "host" however must run to completion, no skipping allowed!
278278
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.custom-publish.result == 'skipped' || needs.custom-publish.result == 'success') }}
279279
runs-on: "ubuntu-latest"
280+
permissions:
281+
"attestations": "write"
282+
"contents": "write"
283+
"id-token": "write"
280284
env:
281285
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
282286
steps:
@@ -295,6 +299,11 @@ jobs:
295299
run: |
296300
# Remove the granular manifests
297301
rm -f artifacts/*-dist-manifest.json
302+
- name: Attest
303+
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8
304+
with:
305+
subject-path: |
306+
artifacts/*
298307
- name: Create GitHub Release
299308
env:
300309
PRERELEASE_FLAG: "${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"

dist-workspace.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ dispatch-releases = true
1717
pr-run-mode = "skip"
1818
# Which phase dist should use to create the GitHub release
1919
github-release = "announce"
20+
# Whether to enable GitHub Attestations
21+
github-attestations = true
22+
# When to generate GitHub Attestations
23+
github-attestations-phase = "announce"
2024
# Whether to publish prereleases to package managers
2125
publish-prereleases = true
2226
# The installers to generate for each app
@@ -65,3 +69,4 @@ global = "ubuntu-latest"
6569
"actions/checkout" = "8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1
6670
"actions/upload-artifact" = "b7c566a772e6b6bfb58ed0dc250532a479d7789f" # v6.0.0
6771
"actions/download-artifact" = "37930b1c2abaa49bbe596cd826c3c89aef350131" # v7.0.0
72+
"actions/attest-build-provenance" = "00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8" # v3.1.0

0 commit comments

Comments
 (0)