1# Publishing the thrift crate
2
3Publishing the Rust thrift crate is straightforward, and involves two major steps:
4
51. Setting up your [crates.io](https://www.crates.io) account _(one-time)_
6
72. Packaging/publishing the Rust thrift crate itself
8
9## Set up your crates.io account (one-time)
10
111. Go to [crates.io](https://www.crates.io) and click the `Log In` button at the top right.
12
13   Log in **as the Github user with write permissions to the thrift repo!**
14
152. Click your user icon button at the top right and select `Account Settings`.
16
173. Click `New Token` next to `API Access`.
18
19   This generates a new API key that cargo uses to publish packages to crates.io.
20   Store this API key somewhere safe. If you will only use this Github account to
21   publish crates to crates.io you can follow the instructions to save the
22   generated key to `~/.cargo/credentials`.
23
24## Package and Publish
25
26You can use the automated script or run the release steps manually.
27
28**Important**: `cargo` expects that version numbers follow the semantic versioning format.
29This means that `THRIFT_RELEASE_VERSION` must have a major, minor and patch number, i.e., must
30be in the form `#.##.##`.
31
32#### Automated
33
34Run `./release.sh [THRIFT_RELEASE_VERSION]`.
35
36_Requires you to have stored your credentials in `~/.cargo/credentials`._
37
38#### Manual
39
401. Edit `Cargo.toml` and update the `version = 1.0` key to `version = [THRIFT_RELEASE_VERSION]`
41
422. `git add Cargo.toml`
43
443. `git commit -m "Update thrift crate version to [THRIFT_RELEASE_VERSION]" -m "Client: rs"`
45
464. `cargo login`
47
48    _(not required if you have stored your credentials in `~/.cargo/credentials`)_
49
505. `cargo clean`
51
526. `cargo package`
53
54   This step fails if there are any uncommitted or ignored files. Do **not** use the `--allow-dirty`
55   flag! Instead, add the highlighted files as entries in the `Cargo.toml` `exclude` key.
56
577. `cargo publish`
58