Skip to content

Commit

Permalink
provenance for docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Apr 22, 2024
1 parent 0d839cf commit d07afd0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,35 @@ jobs:
with:
subject-path: "${{ github.workspace }}/dist/*.*"

# See https://github.com/github-early-access/generate-build-provenance/issues/162
- name: container image digest
id: image
run: |
set -euo pipefail
# Gather the container image generated with goreleaser
image=$(jq -r '.[] | select (.type=="Docker Image") | .path' dist/artifacts.json | cut -d':' -f1 | uniq)
image_1=$(echo $image | head -n1)
image_2=$(echo $image | tail -n1)
# Fetch the digest for the container image (amd64 and arm64)
digest_1=$(docker images --format "{{.Digest}}" --no-trunc $image | sed -n 1p)
digest_2=$(docker images --format "{{.Digest}}" --no-trunc $image | sed -n 2p)
echo "name_1=$image" >> "$GITHUB_OUTPUT"
echo "name_2=$image" >> "$GITHUB_OUTPUT"
echo "digest_1=$digest_1" >> "$GITHUB_OUTPUT"
echo "digest_2=$digest_2" >> "$GITHUB_OUTPUT"
- name: generate build provenance (containers x86_64)
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ steps.image.outputs.name_1 }}
subject-digest: ${{ steps.image.outputs.digest_1 }}

- name: generate build provenance (containers arm64)
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ steps.image.outputs.name_2 }}
subject-digest: ${{ steps.image.outputs.digest_2 }}

- name: GitHub Release
run: make release-notes
env:
Expand Down

0 comments on commit d07afd0

Please sign in to comment.