table of contents
cargo-publish - Upload a package to the registry
cargo publish [OPTIONS]
This command will create a distributable, compressed .crate file with the source code of the package in the current directory and upload it to a registry. The default registry is <https://crates.io>. This performs the following steps:
This command requires you to be authenticated with either the --token option or using cargo-login(1).
See the reference <https://doc.rust-lang.org/cargo/reference/publishing.html> for more details about packaging and publishing.
Cargo config <https://doc.rust-lang.org/cargo/reference/config.html> environment variables can be used to override the tokens stored in the credentials file. The token for crates.io may be specified with the CARGO_REGISTRY_TOKEN environment variable. Tokens for other registries may be specified with environment variables of the form CARGO_REGISTRIES_NAME_TOKEN where NAME is the name of the registry in all capital letters.
This may also be specified with the build.target config value <https://doc.rust-lang.org/cargo/reference/config.html>.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the build cache <https://doc.rust-lang.org/cargo/guide/build-cache.html> documentation for more details.
The feature flags allow you to control the enabled features for the "current" package. The "current" package is the package in the current directory, or the one specified in --manifest-path. If running in the root of a virtual workspace, then the default features are selected for all workspace members, or all features if --all-features is specified.
When no feature options are given, the default feature is activated for every selected package.
These may be used in environments where you want to assert that the Cargo.lock file is up-to-date (such as a CI build) or want to avoid network access.
Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline.
May also be specified with the net.offline config value <https://doc.rust-lang.org/cargo/reference/config.html>.
-j N, --jobs N
May also be specified with the term.color config value <https://doc.rust-lang.org/cargo/reference/config.html>.
See the reference <https://doc.rust-lang.org/cargo/reference/environment-variables.html> for details on environment variables that Cargo reads.