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           Note that specifying this flag makes Cargo run in a different mode
81           where the target artifacts are placed in a separate directory. See
82           the build cache
83           <https://doc.rust-lang.org/cargo/guide/build-cache.html>
84           documentation for more details.
85
86       --target-dir DIRECTORY
87           Directory for all generated artifacts and intermediate files. May
88           also be specified with the CARGO_TARGET_DIR environment variable,
89           or the build.target-dir config value
90           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
91           to target in the root of the workspace.
92
93   Feature Selection
94       The feature flags allow you to control the enabled features for the
95       "current" package. The "current" package is the package in the current
96       directory, or the one specified in --manifest-path. If running in the
97       root of a virtual workspace, then the default features are selected for
98       all workspace members, or all features if --all-features is specified.
99
100       When no feature options are given, the default feature is activated for
101       every selected package.
102
103       --features FEATURES
104           Space or comma separated list of features to activate. These
105           features only apply to the current directory’s package. Features of
106           direct dependencies may be enabled with <dep-name>/<feature-name>
107           syntax. This flag may be specified multiple times, which enables
108           all specified features.
109
110       --all-features
111           Activate all available features of all selected packages.
112
113       --no-default-features
114           Do not activate the default feature of the current directory’s
115           package.
116
117   Manifest Options
118       --manifest-path PATH
119           Path to the Cargo.toml file. By default, Cargo searches for the
120           Cargo.toml file in the current directory or any parent directory.
121
122       --frozen, --locked
123           Either of these flags requires that the Cargo.lock file is
124           up-to-date. If the lock file is missing, or it needs to be updated,
125           Cargo will exit with an error. The --frozen flag also prevents
126           Cargo from attempting to access the network to determine if it is
127           out-of-date.
128
129           These may be used in environments where you want to assert that the
130           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
131           network access.
132
133       --offline
134           Prevents Cargo from accessing the network for any reason. Without
135           this flag, Cargo will stop with an error if it needs to access the
136           network and the network is not available. With this flag, Cargo
137           will attempt to proceed without the network if possible.
138
139           Beware that this may result in different dependency resolution than
140           online mode. Cargo will restrict itself to crates that are
141           downloaded locally, even if there might be a newer version as
142           indicated in the local copy of the index. See the cargo-fetch(1)
143           command to download dependencies before going offline.
144
145           May also be specified with the net.offline config value
146           <https://doc.rust-lang.org/cargo/reference/config.html>.
147
148   Miscellaneous Options
149       -j N, --jobs N
150           Number of parallel jobs to run. May also be specified with the
151           build.jobs config value
152           <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
153           to the number of CPUs.
154
155   Display Options
156       -v, --verbose
157           Use verbose output. May be specified twice for "very verbose"
158           output which includes extra output such as dependency warnings and
159           build script output. May also be specified with the term.verbose
160           config value
161           <https://doc.rust-lang.org/cargo/reference/config.html>.
162
163       -q, --quiet
164           No output printed to stdout.
165
166       --color WHEN
167           Control when colored output is used. Valid values:
168
169           ·   auto (default): Automatically detect if color support is
170               available on the terminal.
171
172           ·   always: Always display colors.
173
174           ·   never: Never display colors.
175
176           May also be specified with the term.color config value
177           <https://doc.rust-lang.org/cargo/reference/config.html>.
178
179   Common Options
180       -h, --help
181           Prints help information.
182
183       -Z FLAG...
184           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
185           details.
186

ENVIRONMENT

188       See the reference
189       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
190       for details on environment variables that Cargo reads.
191

EXIT STATUS

193       0
194           Cargo succeeded.
195
196       101
197           Cargo failed to complete.
198

EXAMPLES

200        1. Publish the current package:
201
202               cargo publish
203

SEE ALSO

205       cargo(1), cargo-package(1), cargo-login(1)
206
207
208
209                                  2019-09-05                  CARGO-PUBLISH(1)
Impressum