LinuxCommandLibrary

cargo-publish

TLDR

Publish to crates.io

$ cargo publish
copy
Dry run without uploading
$ cargo publish --dry-run
copy
Publish without verification
$ cargo publish --no-verify
copy
Allow uncommitted changes
$ cargo publish --allow-dirty
copy
Publish to alternate registry
$ cargo publish --registry [my-registry]
copy
Publish specific package
$ cargo publish -p [crate_name]
copy

SYNOPSIS

cargo publish [options]

DESCRIPTION

cargo publish uploads a package to crates.io or another registry. Creates .crate archive, verifies it builds, and uploads. Publishes are permanent and cannot be deleted.
Requires authentication via cargo login.

PARAMETERS

--dry-run

Perform checks without uploading
--no-verify
Skip build verification
--allow-dirty
Allow uncommitted VCS changes
--registry name
Target registry
--index url
Registry index URL
--token token
API token
-p, --package spec
Package to publish
--target triple
Build target for verification
-j, --jobs n
Parallel jobs
--features features
Enable features for verification
--all-features
Enable all features

PREPARATION

1. Create account on crates.io
2. Verify email address
3. Generate API token
4. Run cargo login

RELEASING NEW VERSIONS

1. Update version in Cargo.toml
2. Optionally run cargo package
3. Run cargo publish

CAVEATS

Publishes are permanent. Use cargo yank to mark versions as deprecated but not delete them. Follow semver for version changes.

SEE ALSO

Copied to clipboard