Skip to content
Latchkey

cargo package: Usage, Options & Common CI Errors

Assemble and verify a crate tarball without publishing.

cargo package creates the .crate file that cargo publish would upload, then compiles it to verify it builds in isolation. It is the safe dry-run before a release.

What it does

Collects the files cargo would publish into a versioned .crate archive under target/package, then builds that archive to confirm it compiles standalone. --list shows the file set without packaging.

Common usage

Terminal
cargo package --list              # show files that would ship
cargo package                     # build and verify the .crate
cargo package --no-verify         # skip the compile step
cargo package --allow-dirty       # ignore uncommitted changes

Common CI error: dirty working directory

cargo package fails with "error: N files in the working directory contain changes that were not yet committed into git" during a release job that generated files. Fix: commit or .gitignore the generated files, or pass --allow-dirty when the changes are intentional and transient.

Options

FlagEffect
--listList packaged files, do not build
--no-verifySkip the build verification
--allow-dirtyAllow uncommitted changes

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →