Skip to content

Plugin: publisher-crates

Publishes Rust crates to crates.io by running cargo publish after semrel has determined and applied the release version. Supports single crates as well as ordered Cargo workspace members.

Terminal window
semrel plugin install @semrel/publisher-crates

semrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.

Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:

Terminal window
docker pull ghcr.io/semrels/publisher-crates:latest

Verify the image signature with cosign:

Terminal window
cosign verify ghcr.io/semrels/publisher-crates:latest \
--certificate-identity-regexp 'https://github.com/SemRels/publisher-crates/.github/workflows/release.yml.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
version: 1
plugins:
- uses: @semrel/updater-cargo
phase: pre-tag
args:
file: Cargo.toml
- uses: @semrel/publisher-crates
phase: release
args:
cargo_registry_token: '${env.CARGO_REGISTRY_TOKEN}'
cargo_workspace_member: "crate-core,crate-cli"
cargo_manifest_path: Cargo.toml
NameRequiredDefaultDescription
SEMREL_PLUGIN_CARGO_REGISTRY_TOKENyes (unless dry-run)—crates.io API token passed to Cargo via CARGO_REGISTRY_TOKEN (never on the command line).
SEMREL_PLUGIN_CARGO_WORKSPACE_MEMBERnodefault packageComma-separated workspace members to publish in order (cargo publish --package <name>).
SEMREL_PLUGIN_CARGO_PACKAGEno—Alias for SEMREL_PLUGIN_CARGO_WORKSPACE_MEMBER.
SEMREL_PLUGIN_CARGO_MANIFEST_PATHnoCargo.tomlManifest path passed as cargo publish --manifest-path <path>.
  • SEMREL_VERSION
  • SEMREL_NEXT_VERSION
  • SEMREL_DRY_RUN
  • Requires cargo on $PATH.
  • Publishes workspace members in the exact order specified and aborts on the first failure.
  • In dry-run mode (SEMREL_DRY_RUN=true), executes cargo publish --dry-run to validate crate packaging without uploading to crates.io.