-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore github release provenance + provenance signing
Got accidentally removed https://github.com/philips-labs/slsa-provenance-action/pull/134/files\#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL197-L212 Signed-off-by: Marco Franssen <[email protected]>
- Loading branch information
1 parent
3645ec0
commit 1a66b6c
Showing
1 changed file
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,47 @@ jobs: | |
docker logout ghcr.io | ||
rm -f cosign.key | ||
provenance: | ||
name: provenance | ||
needs: [release] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Generate provenance for Release | ||
uses: philips-labs/[email protected] | ||
with: | ||
command: generate | ||
subcommand: github-release | ||
arguments: --artifact-path release-assets --output-path provenance.att --tag-name ${{ github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Install cosign | ||
uses: sigstore/[email protected] | ||
with: | ||
cosign-release: 'v1.5.1' | ||
|
||
- name: Sign provenance | ||
run: | | ||
echo '${{ secrets.COSIGN_PRIVATE_KEY }}' > cosign.key | ||
cosign sign-blob --key cosign.key --output-signature "${SIGNATURE}" provenance.att | ||
cat "${SIGNATURE}" | ||
curl_args=(-s -H "Authorization: token ${GITHUB_TOKEN}") | ||
curl_args+=(-H "Accept: application/vnd.github.v3+json") | ||
release_id="$(curl "${curl_args[@]}" "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases?per_page=10" | jq "map(select(.name == \"${GITHUB_REF_NAME}\"))" | jq -r '.[0].id')" | ||
echo "Upload ${SIGNATURE} to release with id ${release_id}…" | ||
curl_args+=(-H "Content-Type: $(file -b --mime-type "${SIGNATURE}")") | ||
curl "${curl_args[@]}" \ | ||
--data-binary @"${SIGNATURE}" \ | ||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${SIGNATURE}" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||
SIGNATURE: provenance.att.sig | ||
|
||
container-provenance: | ||
name: container-provenance | ||
needs: [release] | ||
|
@@ -208,7 +249,7 @@ jobs: | |
cosign-release: 'v1.5.1' | ||
|
||
- name: Generate provenance for ${{ matrix.repo }} | ||
uses: philips-labs/slsa-provenance-action@v0.8.1-draft | ||
uses: philips-labs/slsa-provenance-action@v0.7.1 | ||
with: | ||
command: generate | ||
subcommand: container | ||
|