1CARGO-PUBLISH(1)                                              CARGO-PUBLISH(1)
2
3
4

NAME

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

SYNOPSIS

9       cargo publish [OPTIONS]
10

DESCRIPTION

12       This command will create a distributable, compressed .crate file with
13       the source code of the package in the current directory and upload it
14       to a registry. The default registry is https://crates.io. This performs
15       the following steps:
16
17        1. Performs a few checks, including:
18
19           ·   Checks the package.publish key in the manifest for restrictions
20               on which registries you are allowed to publish to.
21
22        2. Create a .crate file by following the steps in cargo-package(1).
23
24        3. Upload the crate to the registry. Note that the server will perform
25           additional checks on the crate.
26
27       This command requires you to be authenticated with either the --token
28       option or using cargo-login(1).
29
30       See the reference
31       <https://doc.rust-lang.org/cargo/reference/publishing.html> for more
32       details about packaging and publishing.
33

OPTIONS

35   Publish Options
36       --dry-run
37           Perform all checks without uploading.
38
39       --token TOKEN
40           API token to use when authenticating. This overrides the token
41           stored in the credentials file (which is created by
42           cargo-login(1)).
43
44           Cargo config
45           <https://doc.rust-lang.org/cargo/reference/config.html> environment
46           variables can be used to override the tokens stored in the
47           credentials file. The token for crates.io may be specified with the
48           CARGO_REGISTRY_TOKEN environment variable. Tokens for other
49           registries may be specified with environment variables of the form
50           CARGO_REGISTRIES_NAME_TOKEN where NAME is the name of the registry
51           in all capital letters.
52
53       --no-verify
54           Don’t verify the contents by building them.
55
56       --allow-dirty
57           Allow working directories with uncommitted VCS changes to be
58           packaged.
59
60       --index INDEX
61           The URL of the registry index to use.
62
63       --registry REGISTRY
64           Name of the registry to use. Registry names are defined in Cargo
65           config files
66           <https://doc.rust-lang.org/cargo/reference/config.html>. If not
67           specified, the default registry is used, which is defined by the
68           registry.default config key which defaults to crates-io.
69
70   Compilation Options
71       --target TRIPLE
72           Publish for the given architecture. The default is the host
73           architecture. The general format of the triple is
74           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
75           a list of supported targets.
76
77           This may also be specified with the build.target config value
78           <https://doc.rust-lang.org/cargo/reference/config.html>.
79
80       --target-dir DIRECTORY
81           Directory for all generated artifacts and intermediate files. May
82           also be specified with the CARGO_TARGET_DIR environment variable,
83           or the build.target-dir config value
84           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
85           to target in the root of the workspace.
86
87   Feature Selection
88       When no feature options are given, the default feature is activated for
89       every selected package.
90
91       --features FEATURES
92           Space or comma separated list of features to activate. These
93           features only apply to the current directory’s package. Features of
94           direct dependencies may be enabled with <dep-name>/<feature-name>
95           syntax.
96
97       --all-features
98           Activate all available features of all selected packages.
99
100       --no-default-features
101           Do not activate the default feature of the current directory’s
102           package.
103
104   Manifest Options
105       --manifest-path PATH
106           Path to the Cargo.toml file. By default, Cargo searches in the
107           current directory or any parent directory for the Cargo.toml file.
108
109       --frozen, --locked
110           Either of these flags requires that the Cargo.lock file is
111           up-to-date. If the lock file is missing, or it needs to be updated,
112           Cargo will exit with an error. The --frozen flag also prevents
113           Cargo from attempting to access the network to determine if it is
114           out-of-date.
115
116           These may be used in environments where you want to assert that the
117           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
118           network access.
119
120       --offline
121           Prevents Cargo from accessing the network for any reason. Without
122           this flag, Cargo will stop with an error if it needs to access the
123           network and the network is not available. With this flag, Cargo
124           will attempt to proceed without the network if possible.
125
126           Beware that this may result in different dependency resolution than
127           online mode. Cargo will restrict itself to crates that are
128           downloaded locally, even if there might be a newer version as
129           indicated in the local copy of the index. See the cargo-fetch(1)
130           command to download dependencies before going offline.
131
132           May also be specified with the net.offline config value
133           <https://doc.rust-lang.org/cargo/reference/config.html>.
134
135   Miscellaneous Options
136       -j N, --jobs N
137           Number of parallel jobs to run. May also be specified with the
138           build.jobs config value
139           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
140           to the number of CPUs.
141
142   Display Options
143       -v, --verbose
144           Use verbose output. May be specified twice for "very verbose"
145           output which includes extra output such as dependency warnings and
146           build script output. May also be specified with the term.verbose
147           config value
148           <https://doc.rust-lang.org/cargo/reference/config.html>.
149
150       -q, --quiet
151           No output printed to stdout.
152
153       --color WHEN
154           Control when colored output is used. Valid values:
155
156           ·   auto (default): Automatically detect if color support is
157               available on the terminal.
158
159           ·   always: Always display colors.
160
161           ·   never: Never display colors.
162
163           May also be specified with the term.color config value
164           <https://doc.rust-lang.org/cargo/reference/config.html>.
165
166   Common Options
167       -h, --help
168           Prints help information.
169
170       -Z FLAG...
171           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
172           details.
173

ENVIRONMENT

175       See the reference
176       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
177       for details on environment variables that Cargo reads.
178

EXIT STATUS

180       0
181           Cargo succeeded.
182
183       101
184           Cargo failed to complete.
185

EXAMPLES

187        1. Publish the current package:
188
189               cargo publish
190

SEE ALSO

192       cargo(1), cargo-package(1), cargo-login(1)
193
194
195
196                                  2019-06-07                  CARGO-PUBLISH(1)
Impressum