name: release-rust description: Release the freenet-stdlib and/or freenet-macros Rust crates to crates.io. Use when the user says "release the rust crate", "publish freenet-stdlib to crates.io", "cut a rust release", "bump and publish rust", "release freenet-macros", or similar. Can run locally via scripts/release-rust-ver.sh or remotely via the Release workflow on a pushed tag.
Release freenet-stdlib / freenet-macros
Two crates live in this repo:
freenet-stdlibatrust/Cargo.tomlfreenet-macrosatrust-macros/Cargo.toml
Target registry: crates.io. Auth: CARGO_REGISTRY_TOKEN (local) or GitHub secret CARGO_REGISTRY_TOKEN (CI).
Two release paths
Path A — CI (preferred)
- Bump version(s) in Cargo.toml.
- Open PR, merge to main.
- Tag and push:
rust-v<version>→ publishesfreenet-stdlibrust-macros-v<version>→ publishesfreenet-macros
.github/workflows/release.ymlruns: verifies tag matches Cargo.toml version, dry-runs, thencargo publish.
If releasing both, tag macros first (stdlib depends on it) and wait for publish before tagging stdlib.
Path B — Local
bash scripts/release-rust-ver.sh [--yes] [--skip-macros] [--skip-stdlib]
Flags:
--yes/-y— non-interactive--skip-macros— only publish stdlib--skip-stdlib— only publish macros
Requires cargo login or CARGO_REGISTRY_TOKEN env var in shell.
Inputs to gather
- Which crate(s): stdlib, macros, or both.
- Version bump: semver. Show current version from Cargo.toml first.
- Path: CI or local.
Pre-flight
git statusclean- On
main(or deliberately on another branch) cargo publish --dry-run -p <crate>passescargo test --workspacepasses- If stdlib depends on a new macros version, macros must be published first
crates.ioversion does not already exist:cargo search freenet-stdlib
Bump + commit
- Edit
rust/Cargo.tomlorrust-macros/Cargo.tomlversion. - If stdlib bumps its dep on macros, update that too.
- Commit:
git add rust/Cargo.toml git commit -m "chore(rust): bump freenet-stdlib to <version>"
Tag + push (CI path)
git tag -a rust-v<version> -m "Release freenet-stdlib <version>"
git push origin rust-v<version>
For macros: tag rust-macros-v<version>.
Workflow verifies tag matches Cargo.toml version. Mismatch = fail-fast.
Post-publish verification
cargo search freenet-stdlib— should list new version- https://crates.io/crates/freenet-stdlib — should show new version
- Actions tab — release workflow green
Common failures
- Tag/Cargo.toml version mismatch: workflow fails fast. Retag after fix.
- Publish blocked by uncommitted files in workspace:
cargo publishrequires clean state. - Macros dep version not published yet: publish macros first, wait for index refresh, then stdlib.
error: crate version X is already uploaded: version exists. Bump again.- Rate limit: crates.io throttles publishes; wait and retry.
Do not
- Never
cargo yankcasually — only for critical bugs/security. - Never skip
--dry-runon manual local releases. - Never push a tag before the bump commit is on main.
- Never store
CARGO_REGISTRY_TOKENin the repo.