One of the strength of the Rust ecosystem is its package manager [Cargo][] and the package system [crates.io][].
Pulling in some dependencies is as easy as adding it to your projects' `Cargo.toml` and running `cargo build`.
Releasing your own project is nearly as easy. Make sure you got everything working, add a version number in your `Cargo.toml` and run `cargo publish`.
It will package the code and upload it.
Of course that's not the whole story.
For a proper release that people will like to use you want to follow some good practices:
1. Have tests and make sure they are green. Most people already use [Travis CI](https://travis-ci.org). The [travis-cargo](https://github.com/huonw/travis-cargo) project makes it easy to test all channels (stable, beta, nightly, maybe a specific version), run documentation tests and upload coverage info and documentation.
2. Keep a changelog. Your software is not done with the first release. It changes, bugs get fixed, new features get introduced. Keeping a changelog helps users to understand what changed from version to version.
3. Pick a version number. This is not nearly as easy as it sounds. Your project's version number carries a lot of information. Often more than we'd like. The Rust ecosystem recommends to strictly follow [semver][], but even that has ambiguities and requires a lot of thinking to do the right thing.
4. Release on the right platforms. Even though [crates.io][] is the package system you want your project in, having a GitHub release is a nice to have. Maybe your project is an application and you want to distributed pre-compiled binaries.
At the moment a lot of people process each of these steps manually.
Maybe they have a few scripts lying around that help in reducing the number of errors that can happen.
All in all there's still to much manual work required.
It does not have to be that way.
[Stephan Bönnemann][boennemann] build [semantic-release][] for the npm eco system a while ago.
It allows for fully automated package publishing by relying on a few conventions and a lot of automatisation.
I wanted to have a similar thing for the Rust eco system. That's why Jan aka [@neinasaservice][neinasaservice] and I sat down at last year's 32c3 and started hacking on a tool to achieve that.
It took us a while to get something working, but now I can present to you:
[semantic-rs][] gives you fully automatic crate publishing.
It runs after your tests are finished, analyzes the latest commits, picks out a version number, creates a commit and git tag, creates a release on GitHub and publishes your crate on crates.io.
All you have to do is follow the [Angular.js commit message conventions][angular], which are really easy.
Your commit message consists of a type, an optional scope, a subject and an optional body.
At last make sure `semantic-rs` runs after the tests succeeds. Add this to the `.travis.yml`:
~~~yaml
after_success:
- semantic-rs
~~~
Make sure to follow the [AngularJS Git Commit Message Conventions][angular].
`semantic-rs` will use this convention to decide which should be the next release version.
See [the full `.travis.yml`](https://github.com/badboy/test-project/blob/34246077dbf375d144f86a01711cbd9e527b11ea/.travis.yml) of our test project.
## What's next?
We still have some plans for semantic-rs.
First we need to make it more safe and easy to integrate into a project's workflow.
We also want to look into how we can determine more information about a project to assist the developers.
Ideas we have include running integration tests from the previous version to detect breaking changes
and statically analyzing code changes to determine their impact. Rust's [RFC 1105](https://github.com/rust-lang/rfcs/issues/1105) already defines the impact certain changes should have. Maybe it is possible to automatically check some of these things.
We would be happy to hear from you. If semantic-rs breaks or otherwise does not fit into your workflow, let us know. [Open an issue](https://github.com/semantic-rs/semantic-rs/issues/new) to discuss this.
If you want to use it and have more ideas what is necessary or could be improved, talk to us!