diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index 5d3a8355..ebc18cd3 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -38,6 +38,11 @@ jobs: name: Publish Docker container runs-on: ubuntu-latest timeout-minutes: 15 + permissions: + contents: read + packages: write + id-token: write # mint the OIDC token the attestation is signed with + attestations: write # write the build-provenance attestation (the "claim") steps: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -59,6 +64,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=sha - name: Build and push + id: push uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6 with: context: . @@ -67,3 +73,14 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + # GitHub native artifact attestation (build provenance) for the pushed + # image — a signed, verifiable claim binding the image digest to this + # build. Verify with: + # gh attest verify oci://ghcr.io/${{ github.repository }}: \ + # --repo ${{ github.repository }} + - name: Attest container provenance + uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2 + with: + subject-name: ghcr.io/${{ github.repository }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true