Skip to content

ci: publish crates with trusted publishing - #173

Merged
mattsse merged 3 commits into
mainfrom
ci/trusted-publishing
Nov 27, 2026
Merged

mattsse merged 3 commits into
mainfrom
ci/trusted-publishing

Conversation

@grandizzy

@grandizzy grandizzy commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Publish crates to crates.io from CI with trusted publishing instead of personal tokens. Same setup as alloy-rs/alloy#4528.

  • publish.yml: on *-v[0-9]* tags (or a manual run on a tag), checks versions, dry-runs, then publishes from the release environment.
  • release-packages.sh: resolves the crate a <crate>-v<version> tag releases and checks its version.
  • release.toml: publish = false, so cargo release tags and CI publishes.

GitHub runs publish.yml from the tagged commit, so anyone who can push a tag can drop the checks in the workflow. The release environment's reviewers, tag protection, and the crates.io environment pin are what stop an unauthorized publish; none exist yet.

Setup before the first release (repo admin and crates.io owners):

  1. release environment: required reviewers with "Prevent self-review" on, admins not allowed to bypass, deployments limited to tags matching *-v[0-9]* (no branch rules). Reviewers approve only a commit that is on main.
  2. Tag ruleset: restrict creating, updating, and deleting *-v* tags to release maintainers.
  3. crates.io trusted publisher (publish.yml, environment release) for alloy-eip2124, alloy-eip2930, alloy-eip7702, alloy-eip7928, alloy-eip8141. Always set the environment: the verify job holds id-token: write (secure-runner needs it) while it builds dependencies, so a trusted publisher without an environment would let a dependency build script publish. Remove any existing publisher that has no environment.
  4. After the first CI release, revoke the old publish tokens and turn on "Require trusted publishing for all new versions" for each crate.

@tempoxyz-bot

tempoxyz-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

👁️ Cyclops Security Review

✅ Reviewed e7685ad (latest) · Coverage: not needed · ⚠️ 1 open finding · report
ℹ️ This push needed no new audit, and no earlier review of this commit recorded its coverage

# Severity Finding Introduced Status
1 🟡 Medium publish.yml on-main release gate is defined by the pushed tag itself 7480b6b 🟠 Open
2 ⚪ Informational Tag-push-only publish workflow leaves undelivered release tags unpublished 7480b6b ✅ Fixed in bfd5550

Comment on lines +5 to +8
on:
push:
tags:
- "*-v[0-9]*"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (exposure and trigger unconfirmed): publish.yml on-main release gate is defined by the pushed tag itself

The only check that a release tag points at a commit on main is a shell step in publish.yml's verify job. A tag push runs the workflow file from the tagged commit, so an off-main commit that edits that step away still requests the release environment and the publish.yml OIDC identity.

Valid? React with 👍 / 👎.

Comment on lines +5 to +8
on:
push:
tags:
- "*-v[0-9]*"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational: Tag-push-only publish workflow leaves undelivered release tags unpublished

publish.yml starts only from a tag push event and release.toml turns off cargo-release's local publish. If GitHub creates no push event for a release tag, documented for pushes carrying more than three tags, no run starts and the crate is never uploaded. The five-crate workspace needs up to five tags per release.

Valid? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in bfd5550

grandizzy and others added 2 commits November 16, 2026 15:51
Drop the v<version> branch and LOCKSTEP from release-packages.sh: no push
triggers it and the release environment would refuse it. Note on the
publish job that the environment's reviewers are the security boundary.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1e530-c3d3-7112-83c3-faf37ebd3cb9
@grandizzy
grandizzy force-pushed the ci/trusted-publishing branch from a90b98c to e7685ad Compare November 16, 2026 18:03
@mattsse
mattsse merged commit 594cced into main Nov 27, 2026
38 checks passed
@mattsse
mattsse deleted the ci/trusted-publishing branch November 27, 2026 00:25
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.

3 participants