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.
Installation
Section titled “Installation”Binary
Section titled “Binary”semrel plugin install @semrel/publisher-cratessemrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.
Docker
Section titled “Docker”Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:
docker pull ghcr.io/semrels/publisher-crates:latestVerify the image signature with cosign:
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.comConfiguration
Section titled “Configuration”version: 1plugins: - 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.tomlEnvironment Variables
Section titled “Environment Variables”| Name | Required | Default | Description |
|---|---|---|---|
SEMREL_PLUGIN_CARGO_REGISTRY_TOKEN | yes (unless dry-run) | — | crates.io API token passed to Cargo via CARGO_REGISTRY_TOKEN (never on the command line). |
SEMREL_PLUGIN_CARGO_WORKSPACE_MEMBER | no | default package | Comma-separated workspace members to publish in order (cargo publish --package <name>). |
SEMREL_PLUGIN_CARGO_PACKAGE | no | — | Alias for SEMREL_PLUGIN_CARGO_WORKSPACE_MEMBER. |
SEMREL_PLUGIN_CARGO_MANIFEST_PATH | no | Cargo.toml | Manifest path passed as cargo publish --manifest-path <path>. |
Release Context Variables
Section titled “Release Context Variables”SEMREL_VERSIONSEMREL_NEXT_VERSIONSEMREL_DRY_RUN
Behavior
Section titled “Behavior”- Requires
cargoon$PATH. - Publishes workspace members in the exact order specified and aborts on the first failure.
- In dry-run mode (
SEMREL_DRY_RUN=true), executescargo publish --dry-runto validate crate packaging without uploading to crates.io.