Skip to content

ci: publish crate with trusted publishing - #171

Merged
DaniPopes merged 2 commits into
masterfrom
dani/trusted-publishing
Nov 23, 2026
Merged

DaniPopes merged 2 commits into
masterfrom
dani/trusted-publishing

Conversation

@DaniPopes

Copy link
Copy Markdown
Member

Publish the foundryup crate to crates.io from release.yml with trusted publishing, so releases no longer need a hand-run cargo publish. The build and release jobs are unchanged.

Two jobs follow the existing ones. verify has no environment and its id-token is for the secure runner only. It checks that the tagged commit is on master and that the tag matches the version in Cargo.toml, then dry-runs the publish without crates.io access. publish runs in the release environment, re-checks the tag, and uploads with tempoxyz/gh-actions/actions/cargo-publish (verify: false, so no build script runs while crates.io trusts the job). A version already on crates.io is skipped, so a failed run can be rerun.

publish waits for the release job, so a failed binary build stops the release before the crate uploads. The GitHub release does not wait on crates.io, because foundryup self-updates from GitHub releases. Both new jobs skip prerelease tags such as v2.0.0-rc1, whose Cargo.toml version does not match the tag. crates.io's latest version is 0.0.9, so the next release tag, v2.0.0 or a later one, publishes the Cargo.toml version as the first version from CI.

The README does not tell anyone to publish by hand, so it is unchanged.

One-time setup, already done outside this PR: a GitHub environment release limited to v* tags, a release tag ruleset on refs/tags/v*, and this crates.io trusted publisher:

Crate Repository owner Repository Workflow filename Environment
foundryup foundry-rs foundryup release.yml release

Publish foundryup from release.yml after the GitHub release is created, so crates.io can trust that workflow.
@DaniPopes
DaniPopes marked this pull request as ready for review November 20, 2026 14:20
@DaniPopes
DaniPopes merged commit 3a28404 into master Nov 23, 2026
13 checks passed
@DaniPopes
DaniPopes deleted the dani/trusted-publishing branch November 23, 2026 12:40
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