cargo-publish(1)

NAME

cargo-publish --- Upload a package to the registry

SYNOPSIS

cargo publish [options]

DESCRIPTION

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:

  1. Performs a few checks, including:
    • Checks the package.publish key in the manifest for restrictions on which registries you are allowed to publish to.
  2. Create a .crate file by following the steps in cargo-package(1).
  3. Upload the crate to the registry. The server will perform additional checks on the crate.
  4. The client will poll waiting for the package to appear in the index, and may timeout. In that case, you will need to check for completion manually. This timeout does not affect the upload.

This command requires you to be authenticated with either the --token option or using cargo-login(1).

See the reference for more details about packaging and publishing.

OPTIONS

Publish Options

Package Selection

By default, the package in the current working directory is selected. The -p flag can be used to choose a different package in a workspace.

Compilation Options

Feature Selection

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.

Manifest Options

Miscellaneous Options

Display Options

Common Options

ENVIRONMENT

See the reference for details on environment variables that Cargo reads.

EXIT STATUS

  • 0: Cargo succeeded.
  • 101: Cargo failed to complete.

EXAMPLES

  1. Publish the current package:

    cargo publish
    

SEE ALSO

cargo(1), cargo-package(1), cargo-login(1)