cargo release

This a script standardize release process of cargo project for you.

Basically it runs following tasks:

Install

cargo install cargo-release

Usage

cargo release

Prerequisite

Release level

Use -l [level] or --level [level] to specify a release level.

Signing your git commit and tag

Use --sign option to GPG sign your release commits and tags. Further information

Upload rust doc to github pages

By using --upload-doc option, cargo-release will generate rustdoc during release process, and commit the doc directory to gh-pages branch. So you can access your rust doc at https://YOUR-GITHUB-USERNAME.github.io/YOUR-REPOSITORY-NAME/YOUR-CRATE-NAME

If your hosting service uses different branch for pages, you can use --doc-branch to customize the branch we push docs to.

WARNING

This option will override your existed doc branch, use it at your own risk.

Tag prefix

For single-crate repository, we will use version number as git tag name.

For multi-crate repository, the subdirectory name will be used as tag name. For example, when releasing serde_macros 0.7.0 in serde-rs/serde repo, a tag named as serde_macros-0.7.0 will be created.

You can always override this behavior by using --tag-prefix <prefix> option.

Custom remote to push

In case your origin is not writable, you can specify custom remote by --push-remote to set the remote to push.

Use --skip-push if you do not plan to push to anywhere for now.

Specifying dev pre-release extension

After release, the version in Cargo.toml will be incremented and have a pre-release extension added, defaulting to pre.

You can specify a different extension by using the --dev-version-ext <ext> option.

Configuration in Cargo.toml

From 0.6 you can persist options above in Cargo.toml. We use a custom section called package.metadata.release in Cargo.toml to store these options. Available keys:

toml [package.metadata.release] sign-commit = true upload-doc = true pre-release-commit-message = "Release {{version}} 🎉🎉"

Dry run

Always call cargo release --dry-run with your custom options before actually executing it. The dry-run mode will print all commands to execute during the release process. And you will get an overview of what's going on.

Here is an example.

$ cargo release --dry-run cd . git commit -S -am (cargo-release) version 0.18.3 cd - cargo publish Building and exporting docs. cargo doc --no-deps cd target/doc/ git init cd - cd target/doc/ git add . cd - cd target/doc/ git commit -S -am (cargo-release) generate docs cd - cd target/doc/ git push -f git@github.com:sunng87/handlebars-rust.git master:gh-pages cd - git tag -a 0.18.3 -m (cargo-release) version 0.18.3 -s Starting next development iteration 0.18.4-pre cd . git commit -S -am (cargo-release) start next development iteration 0.18.4-pre cd - git push origin --follow-tags

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.