Skip to content
Myr

Generate provenance attestations for release artifacts and docker image (#3225)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Adding https://github.com/actions/attest-build-provenance to the ci builds so that the release assets and docker image for the next release tag generate signed build provenance attestations for workflow artifacts.

authored by lectrical · committed by GitHub · parent 8bcdc93 · Browse files · 1 file+20 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−1 removed

  • other:+20 added−1 removed

1 file+20 added−1 removed

modified:.github/workflows/ci.yml+20 added-1 removed
292 unmodified lines
293294 docker:295 runs-on: ubuntu-latest296 permissions:297 id-token: write298 contents: read299 attestations: write300 packages: write301 needs: linux302 steps:303 - name: Clone repository
27 unmodified lines
331 uses: docker/metadata-action@v5332 id: metadata333 with:334 images: ghcr.io/${{ github.repository }}335 tags: >332 tags: ${{ startsWith(github.ref, 'refs/tags/jq-')336 ${{ startsWith(github.ref, 'refs/tags/jq-')337 && format('type=match,pattern=jq-(.*),group=1,value={0}', github.ref_name)338 || 'type=sha,format=long' }}339 - name: Set up QEMU340 uses: docker/setup-qemu-action@v3
6 unmodified lines
347 username: ${{ github.repository_owner }}348 password: ${{ secrets.GITHUB_TOKEN }}349 - name: Build and release Docker image350 uses: docker/build-push-action@v6351 id: build-push352 with:353 context: .354 push: ${{ startsWith(github.ref, 'refs/tags/jq-') }}355 provenance: false356 platforms: linux/386,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/riscv64,linux/s390x357 tags: ${{ steps.metadata.outputs.tags }}358 labels: ${{ steps.metadata.outputs.labels }}359 - name: Generate signed attestations360 if: startsWith(github.ref, 'refs/tags/jq-')361 uses: actions/attest-build-provenance@v2362 with:363 subject-name: ghcr.io/${{ github.repository }}364 subject-digest: ${{ steps.build-push.outputs.digest }}365 push-to-registry: true366367 release:368 runs-on: ubuntu-latest369 permissions:370 contents: write371 id-token: write372 attestations: write373 pull-requests: write374 environment: release375 needs: [linux, macos, windows, dist, docker]376 if: startsWith(github.ref, 'refs/tags/jq-')
2 unmodified lines
379 uses: actions/checkout@v4380 - name: Download artifacts381 uses: actions/download-artifact@v4382 with:383 pattern: jq-*384 merge-multiple: true385 - name: Upload release386 env:387 TAG_NAME: ${{ github.ref_name }}
4 unmodified lines
392 cp jq-windows-amd64.exe jq-win64.exe393 sha256sum jq-* > sha256sum.txt394 gh release create "$TAG_NAME" --draft --title "jq ${TAG_NAME#jq-}" --generate-notes395 gh release upload "$TAG_NAME" --clobber jq-* sha256sum.txt396 - name: Generate signed attestations397 uses: actions/attest-build-provenance@v2398 with:399 subject-path: jq-*400 - name: Import GPG key401 uses: crazy-max/ghaction-import-gpg@v6402 with:403 gpg_private_key: ${{ secrets.JQ_RELEASE_GPG_PRIVATE_KEY }}
20 unmodified lines