Repository navigation
ci: publish crates via crates.io trusted publishing once a release is signed - #2816
Merged
Merged
Conversation
… signed sign-release.sh takes the release out of draft with the maintainer's gh login; the resulting `release: published` event starts publish-crates.yml, which uploads the workspace through crates.io trusted publishing (OIDC). No crates.io token is stored anywhere. - prepare (contents: read): verifies the tag against KEYS on origin/main, check-release-signed.sh (a good SHA256SUMS.asc by a live key in KEYS, a manifest of this version, every .minisig attached), the binstall guard, crates_to_publish.py (excludes crates crates.io already serves, refuses a crate that does not exist yet), the dashboard build and the verify build. - publish (crates-io environment, id-token: write): runs no build script, proc macro or package install; cargo publish --no-verify with the short-lived token. Re-running uploads only what is missing. The devops bump PR moves to the end of sign-release.sh, and scripts/publish-crates.sh and its tests are deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The tag-controlled release workflow allows authorized tag creators to bypass the signing gate and request a crates.io token, while the documented smoke check fails because the target tag lacks required publishing helpers.
2 open issues
What changed in this PR
Moves crates.io publishing from a local token-based script to GitHub Actions trusted publishing after a maintainer signs and publishes the release. Signing remains local.
Changes:
- Adds separate preparation and publishing jobs, signature checks, and retry-safe upload planning.
- Moves the downstream devops bump into
sign-release.shand removes the local publishing script. - Updates release documentation, workflow permissions, and regression tests.
| File | Description |
|---|---|
scripts/tests/test_sign_release_switches.py |
Tests signing-script skip switches. |
scripts/tests/test_sign_release_publish.py |
Covers devops bump execution, guards, and failures. |
scripts/tests/test_sign_release_key_selection.py |
Disables downstream cloning in signing fixtures. |
scripts/tests/test_publish_crates_assets.py |
Removes tests for the deleted publisher. |
scripts/sign-release.sh |
Reports CI publishing and opens the devops bump. |
scripts/publish-crates.sh |
Removes the local token-based publisher. |
RELEASING.md |
Documents trusted publishing, setup, and recovery. |
release.toml |
Updates comments explaining deferred publishing. |
.github/workflows/release.yml |
Updates publishing-related comments only. |
.github/workflows/publish-crates.yml |
Adds signed-release preparation and trusted publishing. |
.github/scripts/tests/test_pnpm_wrapper.py |
Removes obsolete publisher references from the docstring. |
.github/scripts/tests/test_crates_to_publish.py |
Tests upload planning and registry responses. |
.github/scripts/tests/test_check_release_signed.py |
Tests signature and release-asset checks. |
.github/scripts/pnpm.sh |
Updates the wrapper’s usage comment. |
.github/scripts/crates_to_publish.py |
Plans missing uploads and confirms registry availability. |
.github/scripts/check-release-signed.sh |
Verifies the manifest signature and required assets. |
.github/scripts/check_workspace_manifests.py |
Updates the metadata-consumer comment. |
.github/scripts/check_workflow_hardening.py |
Allows OIDC permission for the publishing job. |
Review effort: Balanced
A `release` event runs the tag's copy of publish-crates.yml, and crates.io matches the workflow by file name and environment, not by ref. With the environment open to `v*` tags, anyone able to push a release tag could carry a workflow that skips the checks and still get the token. - publish-crates.yml is workflow_dispatch only. sign-release.sh dispatches it on main once the release is out of draft; a failed dispatch warns and prints the command, last. - The `release` environment (renamed from `crates-io`) allows `main` only. - The workflow, KEYS and every script and action come from the main commit the run started on; the tag is checked out at src/ and only packaged. The dashboard-build action takes a `root` input for this. It also lets a dispatch against an older tag, such as v0.3.0, run the current checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gas snapshotNo gas changes vs base. |
This was referenced Nov 1, 2026
Closed
thiras
added a commit
to decdn/devops
that referenced
this pull request
Nov 1, 2026
…-bump.sh (#200) decdn/decdn#2816 deleted publish-crates.sh; sign-release.sh now opens the bump PR once the release is out of draft. The invocation is unchanged. Closes #198 Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What
The crates.io upload moves from the local
scripts/publish-crates.sh(personal API token) to a new workflow,.github/workflows/publish-crates.yml, using crates.io trusted publishing. Signing stays local.sign-release.shtakes the release out of draft, then dispatches the workflow onmainwith the tag as input, using the maintainer'sghlogin. The workflow,KEYSand every helper script come from thatmaincommit. The tag is checked out atsrc/and only packaged. Thereleaseenvironment allowsmainonly, so no tag's or branch's copy of the workflow can get the token. No crates.io token is stored anywhere: the job trades its GitHub OIDC token for a 30-minute crates.io token, which the auth action revokes when the job ends.A release is now
cargo release+scripts/sign-release.sh; the crates.io upload follows automatically.prepare(contents: read, no OIDC):KEYSonorigin/main;check-release-signed.sh: the release is out of draft;SHA256SUMS.ascis a good signature by a key inKEYSthat has neither expired nor been revoked; the manifest names this version's archives;SHA256SUMS.minisigand every archive's.minisigare attached;crates_to_publish.py, which excludes crates crates.io already serves at the version and refuses a crate that does not exist on crates.io yet;cargo publish --dry-runverify build.publish(releaseenvironment,id-token: write):prepareand runscargo publish --workspace --no-verify;sign-release.sh.publish-crates.shand its tests are deleted.gh workflow run publish-crates.yml --ref main -f tag=vX.Y.Z.Reviewer notes
Read
.github/workflows/publish-crates.ymlfirst. It is short, and its header covers the trust model. Then readcheck-release-signed.shandcrates_to_publish.py.SHA256SUMS.ascis now verified, not only checked for presence. The check reads gpg's status lines, because a plaingpg --verifyexits 0 for an expired or revoked key.main, not by the tag. The second commit addresses the review's tag-controlled-workflow finding. The remaining trust root ismain(Protect Main; org admins bypass it), the same oneKEYSalready has.releaseenvironment: deployments from branchmainonly (nov*tag pattern), with no reviewers.decdn/decdn,publish-crates.yml, environmentrelease. An individual owner does this.decdn/devops(scripts/open-decdn-bump.sh,AGENTS.md, the node role README) andinternal/Launch/release-checklist.mdstill saypublish-crates.shopens the bump.gh workflow run publish-crates.yml --ref main -f tag=v0.3.0should passprepareand skippublish, since every crate is already at 0.3.0. Locally, main's helpers pass against a v0.3.0 worktree.Verification
pre-commit runon the changed files (passes; thecrypto-bigintcargo-deny advisory predates this branch and is warn-only)uvx --with pyyaml pytest .github/scripts/tests scripts/tests: 617 passedKEYSkeys, a tampered manifest, another release's or an rc's manifest), the upload plan (crates.io statuses, bodies, retries) and the devops bump guards..github/scripts/check-workflow-hardening.sh,.github/scripts/check-toolchain-pin.sh,actionlint,shellcheckcheck-release-signed.sh v0.3.0against the real release and the realKEYS: passescrates_to_publish.py --version 0.3.0against crates.io: all 14 already published, nothing pending🤖 Generated with Claude Code