src/doc/src/commands/cargo-publish.md
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:
package.publish key in the manifest for restrictions on
which registries you are allowed to publish to..crate file by following the steps in cargo-package(1).This command requires you to be authenticated using cargo-login(1)
or environment variables of the registry.token
and registries.<name>.token config fields.
See the reference for more details about packaging and publishing.
By default, when no package selection options are given, the packages selected
depend on the selected manifest file (based on the current working directory if
--manifest-path is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
The default members of a workspace can be set explicitly with the
workspace.default-members key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
--workspace), and a non-virtual workspace will include only the root crate itself.
The feature flags allow you to control which features are enabled. When no
feature options are given, the default feature is activated for every
selected package.
See the features documentation for more details.
<dl> <dt class="option-term" id="option-cargo-publish--F"><a class="option-anchor" href="#option-cargo-publish--F"><code>-F</code> <em>features</em></a></dt> <dt class="option-term" id="option-cargo-publish---features"><a class="option-anchor" href="#option-cargo-publish---features"><code>--features</code> <em>features</em></a></dt> <dd class="option-desc"><p>Space or comma separated list of features to activate. Features of workspace members may be enabled with <code>package-name/feature-name</code> syntax. This flag may be specified multiple times, which enables all specified features.</p> </dd> <dt class="option-term" id="option-cargo-publish---all-features"><a class="option-anchor" href="#option-cargo-publish---all-features"><code>--all-features</code></a></dt> <dd class="option-desc"><p>Activate all available features of all selected packages.</p> </dd> <dt class="option-term" id="option-cargo-publish---no-default-features"><a class="option-anchor" href="#option-cargo-publish---no-default-features"><code>--no-default-features</code></a></dt> <dd class="option-desc"><p>Do not activate the <code>default</code> feature of the selected packages.</p> </dd> </dl>See the reference for details on environment variables that Cargo reads.
0: Cargo succeeded.101: Cargo failed to complete.Publish the current package:
cargo publish