Skip to content

ci: publish crates with trusted publishing - #356

Open
grandizzy wants to merge 1 commit into
mainfrom
ci/trusted-publishing
Open

grandizzy wants to merge 1 commit into
mainfrom
ci/trusted-publishing

Conversation

@grandizzy

Copy link
Copy Markdown
Contributor

Publishes this repo's crates to crates.io from CI with trusted publishing, so releases no longer need a maintainer's long-lived crates.io token. Same setup as alloy-rs/alloy#4528.

  • .github/workflows/publish.yml: Runs when a release tag matching v* is pushed. verify checks the tagged commit is on main and the crate versions match the tag, then dry-runs the publish without OIDC. publish runs in the release environment, checks the tag still points at the verified commit, and uploads with tempoxyz/gh-actions/actions/cargo-publish in dependency order (already published versions are skipped, so a rerun resumes).
  • github-release creates the GitHub release with generated notes from the previous v* tag once the crates are up.
  • .github/scripts/release-packages.sh: resolves which crates a tag releases. A v1.2.3 tag publishes every crate in the workspace, which must all be at 1.2.3.
  • release.toml: sets publish = false, so cargo release still bumps, commits and tags, and CI publishes.

Tested release-packages.sh against the current manifests (latest tag resolves, wrong version/unknown crate/bad tag fail); actionlint, shellcheck and zizmor are clean.

Before the first CI release (needs repo and crate owners)

  1. Create a release environment with required reviewers and a deployment tag rule for v*; add a tag ruleset protecting the same pattern.
  2. On crates.io, add a GitHub trusted publisher (owner alloy-rs, repo chains, workflow publish.yml, environment release) to: alloy-chains.
  3. After the first release goes out through CI, enable "trusted publishing only" on those crates and revoke the personal publish tokens.

@tempoxyz-bot

tempoxyz-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

👁️ Cyclops Security Review

✅ Reviewed 5e76b09 (latest) · Coverage: partial · no open findings · report
⚠️ Not checked: The workflow definition is taken from the tagged commit, so the repository check, main-ancestry check, version match and dry run in publish.yml do not constrain an actor able to push a v* tag at a commit carrying a modified publish.yml. The
⚠️ Not checked: tempoxyz/gh-actions at 763efe11a9d8333bcbf0bb2f5ab80f21961c48fd (cargo-publish, secure-runner, vendor/dtolnay/rust-toolchain) is not among the pinned sources. Unverified: that dry-run: true performs no OIDC exchange with crates.io, that ver
⚠️ Not checked: actions/checkout at 3d3c42e5aac5ba805825da76410c181273ba90b1 is not among the pinned sources. The main-ancestry check assumes that fetch-depth 0 with a commit sha ref populates refs/remotes/origin/main and tags; if it does not, verify fails
⚠️ 6 more unchecked questions are listed in the report
ℹ️ Not verifiable from the source alone (needs running code or deployed state): No workflow run was observed. Assumed but unverified: GITHUB_SHA for a signed annotated tag push is the peeled commit (otherwise line 37 fails closed and blocks every release), and a re-pushed tag for (2 more in the report)

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.

2 participants