Skip to content

Attest release builds, make the release job re-runnable, document verification - #1

Merged
devGregA merged 3 commits into
mainfrom
release/attest-provenance
Nov 20, 2026
Merged

devGregA merged 3 commits into
mainfrom
release/attest-provenance

Conversation

@devGregA

Copy link
Copy Markdown
Contributor

The release workflow now runs as three jobs, each with only the permissions it needs:

  • build (contents: read): runs the tests, rebuilds dist/ and checks it matches the files committed at the tag.
  • attest (id-token: write and attestations: write only; runs no repository code): creates a build provenance attestation for dist/index.mjs and dist/licenses.txt with actions/attest-build-provenance, pinned by SHA.
  • release (contents: write): checks the files match the tag, creates the release with both files attached, and moves the major tag.

The release job can be re-run. It creates the release only if none exists. It publishes a draft left by an earlier run. On a release that is already published, it uploads only missing assets and fails if an attached asset differs from the build.

From the next release on, each release carries a build provenance attestation. Verify it with:

gh attestation verify dist/index.mjs --repo DefectDojo/defectdojo-action \
  --signer-workflow DefectDojo/defectdojo-action/.github/workflows/release.yml \
  --source-ref refs/tags/<version>

The README's first example now pins the action to the commit of v1.0.0. New sections cover how to reference a release (commit SHA, version tag or major tag; never a branch) and how to verify one. .gitattributes marks dist/ as binary so checkouts with core.autocrlf=true keep the attested bytes.

Repository settings for an admin (this PR changes none):

  1. Settings → General → Releases → Enable release immutability. It applies to new releases only; v1.0.0 stays as it is.
  2. Never publish a GitHub release on the major tag v1. It is a plain git tag that the release workflow moves, and an immutable release on it would freeze it.
  3. If you add a tag ruleset, scope it to v*.*.*, not v*, so the workflow can still move v1.

To check on the first release after merging: the attestation appears under the repository's Attestations, both files are attached to the release, v1 moves, and the gh attestation verify command above passes.

🤖 Generated with Claude Code

devGregA and others added 3 commits November 20, 2026 00:50
The release workflow now runs as three jobs with their own permissions:
build (contents: read) tests and rebuilds dist/ and checks it matches
the tag, attest (id-token and attestations write only, no repository
code) signs a build provenance attestation for dist/index.mjs and
dist/licenses.txt, and release (contents: write) creates the release
with both files attached and moves the major tag.

gh release create uploads the assets to a draft before publishing, so
the flow works with immutable releases. The major tag stays a plain
git tag, not a release, so it remains movable with that setting on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first README example pins the action to the commit of v1.0.0, as
the README already advises for every action. A Versions section lists
the ways to point at a release (commit SHA, version tag, major tag) and
advises against branches. A Verifying a release section shows how to
check dist/index.mjs with gh attestation verify --repo
DefectDojo/defectdojo-action. SECURITY.md links to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
If the release job fails after the release is published, for example
when moving the major tag, a re-run used to stop at gh release create
because the release exists. It now creates the release only if none
exists. A draft left by an earlier run gets its assets replaced and is
published. A published release gets only missing assets uploaded, and
an attached asset that differs from this build fails the step.

.gitattributes marks dist/ as binary so a checkout with
core.autocrlf=true keeps the bytes that were attested. The committed
files are unchanged.

The README's command for finding a release's commit now works for
lightweight and annotated tags, and the release workflow's header says
to bump the README's pinned SHA after each release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devGregA
devGregA merged commit dfff693 into main Nov 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant