blob: 716127628cbaa3fded3cc3ba0e0197c797f3884f [file] [log] [blame]
Jeff Vander Stoep956d1432020-09-18 13:46:24 +02001'\" t
2.\" Title: cargo-publish
3.\" Author: [see the "AUTHOR(S)" section]
4.\" Generator: Asciidoctor 2.0.10
5.\" Date: 2019-09-05
6.\" Manual: \ \&
7.\" Source: \ \&
8.\" Language: English
9.\"
10.TH "CARGO\-PUBLISH" "1" "2019-09-05" "\ \&" "\ \&"
11.ie \n(.g .ds Aq \(aq
12.el .ds Aq '
13.ss \n[.ss] 0
14.nh
15.ad l
16.de URL
17\fI\\$2\fP <\\$1>\\$3
18..
19.als MTO URL
20.if \n[.g] \{\
21. mso www.tmac
22. am URL
23. ad l
24. .
25. am MTO
26. ad l
27. .
28. LINKSTYLE blue R < >
29.\}
30.SH "NAME"
31cargo\-publish \- Upload a package to the registry
32.SH "SYNOPSIS"
33.sp
34\fBcargo publish [\fIOPTIONS\fP]\fP
35.SH "DESCRIPTION"
36.sp
37This command will create a distributable, compressed \fB.crate\fP file with the
38source code of the package in the current directory and upload it to a
39registry. The default registry is \c
40.URL "https://crates.io" "" "."
41This performs the
42following steps:
43.sp
44.RS 4
45.ie n \{\
46\h'-04' 1.\h'+01'\c
47.\}
48.el \{\
49. sp -1
50. IP " 1." 4.2
51.\}
52Performs a few checks, including:
53.sp
54.RS 4
55.ie n \{\
56\h'-04'\(bu\h'+03'\c
57.\}
58.el \{\
59. sp -1
60. IP \(bu 2.3
61.\}
62Checks the \fBpackage.publish\fP key in the manifest for restrictions on which
63registries you are allowed to publish to.
64.RE
65.RE
66.sp
67.RS 4
68.ie n \{\
69\h'-04' 2.\h'+01'\c
70.\}
71.el \{\
72. sp -1
73. IP " 2." 4.2
74.\}
75Create a \fB.crate\fP file by following the steps in \fBcargo\-package\fP(1).
76.RE
77.sp
78.RS 4
79.ie n \{\
80\h'-04' 3.\h'+01'\c
81.\}
82.el \{\
83. sp -1
84. IP " 3." 4.2
85.\}
86Upload the crate to the registry. Note that the server will perform
87additional checks on the crate.
88.RE
89.sp
90This command requires you to be authenticated with either the \fB\-\-token\fP option
91or using \fBcargo\-login\fP(1).
92.sp
93See \c
94.URL "https://doc.rust\-lang.org/cargo/reference/publishing.html" "the reference" " "
95for more details about
96packaging and publishing.
97.SH "OPTIONS"
98.SS "Publish Options"
99.sp
100\fB\-\-dry\-run\fP
101.RS 4
102Perform all checks without uploading.
103.RE
104.sp
105\fB\-\-token\fP \fITOKEN\fP
106.RS 4
107API token to use when authenticating. This overrides the token stored in
108the credentials file (which is created by \fBcargo\-login\fP(1)).
109.sp
110.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "Cargo config" " "
111environment variables can be
112used to override the tokens stored in the credentials file. The token for
113crates.io may be specified with the \fBCARGO_REGISTRY_TOKEN\fP environment
114variable. Tokens for other registries may be specified with environment
115variables of the form \fBCARGO_REGISTRIES_NAME_TOKEN\fP where \fBNAME\fP is the name
116of the registry in all capital letters.
117.RE
118.sp
119\fB\-\-no\-verify\fP
120.RS 4
121Don\(cqt verify the contents by building them.
122.RE
123.sp
124\fB\-\-allow\-dirty\fP
125.RS 4
126Allow working directories with uncommitted VCS changes to be packaged.
127.RE
128.sp
129\fB\-\-index\fP \fIINDEX\fP
130.RS 4
131The URL of the registry index to use.
132.RE
133.sp
134\fB\-\-registry\fP \fIREGISTRY\fP
135.RS 4
136Name of the registry to use. Registry names are defined in \c
137.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "Cargo config files" "."
138If not specified, the default registry is used, which is defined by the
139\fBregistry.default\fP config key which defaults to \fBcrates\-io\fP.
140.RE
141.SS "Compilation Options"
142.sp
143\fB\-\-target\fP \fITRIPLE\fP
144.RS 4
145Publish for the given architecture. The default is the host
146architecture. The general format of the triple is
147\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a
148list of supported targets.
149.sp
150This may also be specified with the \fBbuild.target\fP
151.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
152.sp
153Note that specifying this flag makes Cargo run in a different mode where the
154target artifacts are placed in a separate directory. See the
155.URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " "
156documentation for more details.
157.RE
158.sp
159\fB\-\-target\-dir\fP \fIDIRECTORY\fP
160.RS 4
161Directory for all generated artifacts and intermediate files. May also be
162specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the
163\fBbuild.target\-dir\fP \c
164.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
165Defaults
166to \fBtarget\fP in the root of the workspace.
167.RE
168.SS "Feature Selection"
169.sp
170The feature flags allow you to control the enabled features for the "current"
171package. The "current" package is the package in the current directory, or the
172one specified in \fB\-\-manifest\-path\fP. If running in the root of a virtual
173workspace, then the default features are selected for all workspace members,
174or all features if \fB\-\-all\-features\fP is specified.
175.sp
176When no feature options are given, the \fBdefault\fP feature is activated for
177every selected package.
178.sp
179\fB\-\-features\fP \fIFEATURES\fP
180.RS 4
181Space or comma separated list of features to activate. These features only
182apply to the current directory\(cqs package. Features of direct dependencies
183may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax. This flag may be
184specified multiple times, which enables all specified features.
185.RE
186.sp
187\fB\-\-all\-features\fP
188.RS 4
189Activate all available features of all selected packages.
190.RE
191.sp
192\fB\-\-no\-default\-features\fP
193.RS 4
194Do not activate the \fBdefault\fP feature of the current directory\(cqs
195package.
196.RE
197.SS "Manifest Options"
198.sp
199\fB\-\-manifest\-path\fP \fIPATH\fP
200.RS 4
201Path to the \fBCargo.toml\fP file. By default, Cargo searches for the
202\fBCargo.toml\fP file in the current directory or any parent directory.
203.RE
204.sp
205\fB\-\-frozen\fP, \fB\-\-locked\fP
206.RS 4
207Either of these flags requires that the \fBCargo.lock\fP file is
208up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
209exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
210attempting to access the network to determine if it is out\-of\-date.
211.sp
212These may be used in environments where you want to assert that the
213\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
214access.
215.RE
216.sp
217\fB\-\-offline\fP
218.RS 4
219Prevents Cargo from accessing the network for any reason. Without this
220flag, Cargo will stop with an error if it needs to access the network and
221the network is not available. With this flag, Cargo will attempt to
222proceed without the network if possible.
223.sp
224Beware that this may result in different dependency resolution than online
225mode. Cargo will restrict itself to crates that are downloaded locally, even
226if there might be a newer version as indicated in the local copy of the index.
227See the \fBcargo\-fetch\fP(1) command to download dependencies before going
228offline.
229.sp
230May also be specified with the \fBnet.offline\fP \c
231.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
232.RE
233.SS "Miscellaneous Options"
234.sp
235\fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP
236.RS 4
237Number of parallel jobs to run. May also be specified with the
238\fBbuild.jobs\fP \c
239.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
240Defaults to
241the number of CPUs.
242.RE
243.SS "Display Options"
244.sp
245\fB\-v\fP, \fB\-\-verbose\fP
246.RS 4
247Use verbose output. May be specified twice for "very verbose" output which
248includes extra output such as dependency warnings and build script output.
249May also be specified with the \fBterm.verbose\fP
250.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
251.RE
252.sp
253\fB\-q\fP, \fB\-\-quiet\fP
254.RS 4
255No output printed to stdout.
256.RE
257.sp
258\fB\-\-color\fP \fIWHEN\fP
259.RS 4
260Control when colored output is used. Valid values:
261.sp
262.RS 4
263.ie n \{\
264\h'-04'\(bu\h'+03'\c
265.\}
266.el \{\
267. sp -1
268. IP \(bu 2.3
269.\}
270\fBauto\fP (default): Automatically detect if color support is available on the
271terminal.
272.RE
273.sp
274.RS 4
275.ie n \{\
276\h'-04'\(bu\h'+03'\c
277.\}
278.el \{\
279. sp -1
280. IP \(bu 2.3
281.\}
282\fBalways\fP: Always display colors.
283.RE
284.sp
285.RS 4
286.ie n \{\
287\h'-04'\(bu\h'+03'\c
288.\}
289.el \{\
290. sp -1
291. IP \(bu 2.3
292.\}
293\fBnever\fP: Never display colors.
294.RE
295.sp
296May also be specified with the \fBterm.color\fP
297.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
298.RE
299.SS "Common Options"
300.sp
301\fB+TOOLCHAIN\fP
302.RS 4
303If Cargo has been installed with rustup, and the first argument to \fBcargo\fP
304begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such
305as \fB+stable\fP or \fB+nightly\fP).
306See the \c
307.URL "https://github.com/rust\-lang/rustup/" "rustup documentation"
308for more information about how toolchain overrides work.
309.RE
310.sp
311\fB\-h\fP, \fB\-\-help\fP
312.RS 4
313Prints help information.
314.RE
315.sp
316\fB\-Z\fP \fIFLAG\fP...
317.RS 4
318Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for
319details.
320.RE
321.SH "ENVIRONMENT"
322.sp
323See \c
324.URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " "
325for
326details on environment variables that Cargo reads.
327.SH "EXIT STATUS"
328.sp
3290
330.RS 4
331Cargo succeeded.
332.RE
333.sp
334101
335.RS 4
336Cargo failed to complete.
337.RE
338.SH "EXAMPLES"
339.sp
340.RS 4
341.ie n \{\
342\h'-04' 1.\h'+01'\c
343.\}
344.el \{\
345. sp -1
346. IP " 1." 4.2
347.\}
348Publish the current package:
349.sp
350.if n .RS 4
351.nf
352cargo publish
353.fi
354.if n .RE
355.RE
356.SH "SEE ALSO"
357.sp
358\fBcargo\fP(1), \fBcargo\-package\fP(1), \fBcargo\-login\fP(1)