1CARGO-PUBLISH(1) CARGO-PUBLISH(1)
2
3
4
6 cargo-publish - Upload a package to the registry
7
9 cargo publish [OPTIONS]
10
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
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 Miscellaneous Options
121 -j N, --jobs N
122 Number of parallel jobs to run. May also be specified with the
123 build.jobs config value
124 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
125 to the number of CPUs.
126
127 Display Options
128 -v, --verbose
129 Use verbose output. May be specified twice for "very verbose"
130 output which includes extra output such as dependency warnings and
131 build script output. May also be specified with the term.verbose
132 config value
133 <https://doc.rust-lang.org/cargo/reference/config.html>.
134
135 -q, --quiet
136 No output printed to stdout.
137
138 --color WHEN
139 Control when colored output is used. Valid values:
140
141 · auto (default): Automatically detect if color support is
142 available on the terminal.
143
144 · always: Always display colors.
145
146 · never: Never display colors.
147
148 May also be specified with the term.color config value
149 <https://doc.rust-lang.org/cargo/reference/config.html>.
150
151 Common Options
152 -h, --help
153 Prints help information.
154
155 -Z FLAG...
156 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
157 details.
158
160 See the reference
161 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
162 for details on environment variables that Cargo reads.
163
165 0
166 Cargo succeeded.
167
168 101
169 Cargo failed to complete.
170
172 1. Publish the current package:
173
174 cargo publish
175
177 cargo(1), cargo-package(1), cargo-login(1)
178
179
180
181 2019-02-13 CARGO-PUBLISH(1)