@@ -10,11 +10,14 @@ concurrency:
1010permissions :
1111 contents : write
1212 packages : write
13+ id-token : write # cosign keyless OIDC + SLSA provenance
1314
1415jobs :
1516 release :
1617 runs-on : ubuntu-latest
1718 timeout-minutes : 20
19+ outputs :
20+ hashes : ${{ steps.hash.outputs.hashes }}
1821 steps :
1922 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2023 with :
@@ -28,13 +31,41 @@ jobs:
2831 username : ${{ github.actor }}
2932 password : ${{ secrets.GITHUB_TOKEN }}
3033 - uses : ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
34+ - uses : sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
35+ - uses : anchore/sbom-action/download-syft@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8
3136 - uses : goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
3237 with :
3338 version : " ~> v2"
3439 args : release --clean
3540 env :
3641 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3742 HOMEBREW_TAP_TOKEN : ${{ secrets.HOMEBREW_TAP_TOKEN }}
43+ - name : Compute artifact hashes for SLSA provenance
44+ id : hash
45+ working-directory : dist
46+ run : |
47+ set -euo pipefail
48+ shopt -s nullglob
49+ subjects=(*.tar.gz *.zip *.deb *.rpm *.apk *.sbom.cdx.json checksums.txt)
50+ if [ ${#subjects[@]} -eq 0 ]; then
51+ echo "no release artifacts found in dist/" >&2
52+ exit 1
53+ fi
54+ echo "hashes=$(sha256sum -- "${subjects[@]}" | base64 -w0)" >> "$GITHUB_OUTPUT"
55+
56+ # SLSA Level 3 build provenance for binary release artifacts.
57+ # Reusable workflow MUST be referenced by tag (not commit SHA): the generator
58+ # verifies its own ref and rejects unpinned references at runtime.
59+ provenance :
60+ needs : [release]
61+ permissions :
62+ actions : read
63+ id-token : write
64+ contents : write
65+ uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
66+ with :
67+ base64-subjects : " ${{ needs.release.outputs.hashes }}"
68+ upload-assets : true
3869
3970 verify :
4071 needs : release
5687 method : homebrew
5788 - runner : ubuntu-latest
5889 method : go-install
90+ - runner : ubuntu-latest
91+ method : cosign-checksums
92+ - runner : ubuntu-latest
93+ method : cosign-image
5994 runs-on : ${{ matrix.runner }}
6095 timeout-minutes : 10
6196 steps :
@@ -113,10 +148,47 @@ jobs:
113148 augur --version
114149
115150 - name : Install from Homebrew
116- if : matrix.method == 'homebrew'
151+ if : matrix.method == 'homebrew' && !contains(github.ref_name, '-')
117152 run : |
118153 brew install --cask starkross/tap/augur
119154 augur --version
120155
156+ - name : Skip Homebrew verify on pre-release
157+ if : matrix.method == 'homebrew' && contains(github.ref_name, '-')
158+ run : echo "Skipping Homebrew verify for pre-release ${GITHUB_REF_NAME} (tap is not updated for pre-releases by design)."
159+
160+ - name : Install cosign
161+ if : startsWith(matrix.method, 'cosign-')
162+ uses : sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
163+
164+ - name : Verify checksums.txt cosign signature
165+ if : matrix.method == 'cosign-checksums'
166+ env :
167+ IDENTITY_REGEX : https://github.com/${{ github.repository }}/.github/workflows/release.yml@refs/tags/v.*
168+ OIDC_ISSUER : https://token.actions.githubusercontent.com
169+ run : |
170+ set -euo pipefail
171+ base="https://github.com/${{ github.repository }}/releases/download/${GITHUB_REF_NAME}"
172+ curl -fsSL "${base}/checksums.txt" -o checksums.txt
173+ curl -fsSL "${base}/checksums.txt.sig" -o checksums.txt.sig
174+ curl -fsSL "${base}/checksums.txt.pem" -o checksums.txt.pem
175+ cosign verify-blob \
176+ --certificate checksums.txt.pem \
177+ --signature checksums.txt.sig \
178+ --certificate-identity-regexp "${IDENTITY_REGEX}" \
179+ --certificate-oidc-issuer "${OIDC_ISSUER}" \
180+ checksums.txt
181+
182+ - name : Verify container image cosign signature
183+ if : matrix.method == 'cosign-image'
184+ env :
185+ IDENTITY_REGEX : https://github.com/${{ github.repository }}/.github/workflows/release.yml@refs/tags/v.*
186+ OIDC_ISSUER : https://token.actions.githubusercontent.com
187+ run : |
188+ set -euo pipefail
189+ cosign verify "ghcr.io/starkross/augur:${{ steps.version.outputs.version }}" \
190+ --certificate-identity-regexp "${IDENTITY_REGEX}" \
191+ --certificate-oidc-issuer "${OIDC_ISSUER}"
192+
121193 - name : Verify version output
122194 run : echo "Successfully installed augur ${{ steps.version.outputs.version }} via ${{ matrix.method }}"
0 commit comments