Skip to content

Commit c395207

Browse files
committed
ci: Verify SLSA3 provenance after release.
1 parent d4761fe commit c395207

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,35 @@ jobs:
9090
push: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
9191
tags: ${{ steps.meta.outputs.tags }}
9292
labels: ${{ steps.meta.outputs.labels }}
93+
94+
verify:
95+
needs: [goreleaser, provenance]
96+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
97+
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
100+
env:
101+
CHECKSUMS: ${{ needs.goreleaser.outputs.hashes }}
102+
PROVENANCE: "${{ needs.provenance.outputs.provenance-name }}"
103+
steps:
104+
- uses: slsa-framework/slsa-verifier/actions/installer@v2.5.1
105+
- name: download assets
106+
env:
107+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
run: |
109+
set -euo pipefail
110+
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.tar.gz"
111+
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.zip"
112+
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "$PROVENANCE"
113+
- name: verify assets
114+
run: |
115+
set -euo pipefail
116+
checksums=$(echo "$CHECKSUMS" | base64 -d)
117+
while read -r line; do
118+
fn=$(echo $line | cut -d ' ' -f2)
119+
echo "Verifying $fn"
120+
slsa-verifier verify-artifact --provenance-path "$PROVENANCE" \
121+
--source-uri "github.com/$GITHUB_REPOSITORY" \
122+
--source-tag "$GITHUB_REF_NAME" \
123+
"$fn"
124+
done <<<"$checksums"

0 commit comments

Comments
 (0)