|
| 1 | +# Release Guide |
| 2 | + |
| 3 | +Step-by-step process for cutting a new TypeRush release and publishing it to |
| 4 | +[crates.io](https://crates.io/crates/typerush). Run through every section in |
| 5 | +order — the order matters (see the note at the bottom on tag-before-publish). |
| 6 | + |
| 7 | +Examples below use `v0.2.0`. Substitute the version you are actually shipping. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## 1. Pre-flight: working tree sanity |
| 12 | + |
| 13 | +Before doing anything else, confirm: |
| 14 | + |
| 15 | +- `git status` is clean. |
| 16 | +- Local `main` is in sync with `origin/main` (`git status -sb` shows no |
| 17 | + ahead/behind). |
| 18 | +- `Cargo.toml`'s `version = "..."` matches the version you intend to tag. |
| 19 | +- No tag for that version exists yet: `git tag -l`. |
| 20 | +- `CHANGELOG.md` has a finalized entry for the version (date filled in, not |
| 21 | + `Unreleased`). |
| 22 | + |
| 23 | +If any of these is wrong, fix it and commit before continuing. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## 2. Local verification |
| 28 | + |
| 29 | +These must all pass on the version-bump commit: |
| 30 | + |
| 31 | +```bash |
| 32 | +cargo fmt --all -- --check |
| 33 | +cargo clippy --all-targets --all-features -- -D warnings |
| 34 | +cargo test --all |
| 35 | +cargo build --release |
| 36 | +``` |
| 37 | + |
| 38 | +Then smoke-test the actual release binary — type checking and unit tests do not |
| 39 | +catch TUI regressions: |
| 40 | + |
| 41 | +```bash |
| 42 | +./target/release/typerush |
| 43 | +``` |
| 44 | + |
| 45 | +Exercise the things that changed in this release. For v0.2.0 that means at |
| 46 | +minimum: |
| 47 | + |
| 48 | +- Run a short typing test end-to-end. |
| 49 | +- Switch themes (the v0.2 background paint work). |
| 50 | +- Trigger `Ctrl+Backspace` mid-word (the v0.2 input fix). |
| 51 | +- Run with `--help` and with a non-default config to exercise config loading. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## 3. Package-shape check (the important one before publish) |
| 56 | + |
| 57 | +`cargo publish --dry-run` alone is not enough — it builds, but it does not show |
| 58 | +you the file list. Always run `cargo package --list` first so you can *see* |
| 59 | +what will be uploaded. |
| 60 | + |
| 61 | +```bash |
| 62 | +cargo package --list # lists every file that will end up in the .crate |
| 63 | +cargo package # builds the .crate into target/package/ |
| 64 | +cargo publish --dry-run # builds from that tarball, no upload |
| 65 | +``` |
| 66 | + |
| 67 | +Eyeball the file list: |
| 68 | + |
| 69 | +- ✅ Present: `README.md`, `LICENSE`, `CHANGELOG.md`, `Cargo.toml`, `src/**`, |
| 70 | + `config.example.toml`. |
| 71 | +- ❌ Absent: `assets/`, `.github/`, `*.tape`, `*.mp4`, `*.gif`, `docs/` (if |
| 72 | + excluded), local dev junk. |
| 73 | +- Crate size should be in the hundreds-of-KB range, not multiple MB. A bloated |
| 74 | + tarball usually means the `exclude` list in `Cargo.toml` is missing a path. |
| 75 | + |
| 76 | +If the file list is wrong, update `exclude` in `Cargo.toml`, commit, and |
| 77 | +re-run. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## 4. Docs sanity |
| 82 | + |
| 83 | +`docs.rs` runs `cargo doc` after publish. A failure there is annoying and |
| 84 | +public, so catch it locally first: |
| 85 | + |
| 86 | +```bash |
| 87 | +cargo doc --no-deps |
| 88 | +``` |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 5. Tag and create the GitHub release |
| 93 | + |
| 94 | +Only after sections 2–4 are all green. |
| 95 | + |
| 96 | +```bash |
| 97 | +git tag -a v0.2.0 -m "v0.2.0" |
| 98 | +git push origin v0.2.0 |
| 99 | + |
| 100 | +gh release create v0.2.0 \ |
| 101 | + --title "v0.2.0" \ |
| 102 | + --notes-from-tag |
| 103 | +# or: --notes-file with the relevant slice of CHANGELOG.md |
| 104 | +``` |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +## 6. Publish to crates.io |
| 109 | + |
| 110 | +```bash |
| 111 | +cargo login # only if not already logged in on this machine |
| 112 | +cargo publish # no --dry-run this time |
| 113 | +``` |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +## 7. Post-publish verification |
| 118 | + |
| 119 | +- `cargo search typerush` — confirm the new version is listed. |
| 120 | +- Visit <https://crates.io/crates/typerush> — version, README, and metadata |
| 121 | + render correctly. |
| 122 | +- Visit <https://docs.rs/typerush> — the docs build can take a few minutes |
| 123 | + after publish; if it fails, the build log is linked from that page. |
| 124 | +- Optional: `cargo install typerush --version 0.2.0` in a scratch directory to |
| 125 | + prove a clean install works end-to-end. |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## Why tag before publish |
| 130 | + |
| 131 | +Tag first (§5), publish second (§6). The reason: |
| 132 | + |
| 133 | +- A crates.io version is **immutable** once uploaded. You cannot replace, |
| 134 | + yank-and-reupload, or amend it. |
| 135 | +- A git tag is cheap to move or delete before it's been pulled by others. |
| 136 | + |
| 137 | +So if anything goes wrong, you want the failure to happen on the side that is |
| 138 | +recoverable. If `cargo publish` fails after the tag is pushed, you fix the code, |
| 139 | +bump to the next patch version, and re-tag. If you publish first and then |
| 140 | +realize the tag points at the wrong commit, you are stuck with a published |
| 141 | +crate that does not match any tag. |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Quick reference (happy-path commands) |
| 146 | + |
| 147 | +```bash |
| 148 | +# 1. sanity |
| 149 | +git status && git tag -l |
| 150 | + |
| 151 | +# 2. verify |
| 152 | +cargo fmt --all -- --check |
| 153 | +cargo clippy --all-targets --all-features -- -D warnings |
| 154 | +cargo test --all |
| 155 | +cargo build --release |
| 156 | +./target/release/typerush |
| 157 | + |
| 158 | +# 3. package shape |
| 159 | +cargo package --list |
| 160 | +cargo publish --dry-run |
| 161 | + |
| 162 | +# 4. docs |
| 163 | +cargo doc --no-deps |
| 164 | + |
| 165 | +# 5. tag + release |
| 166 | +git tag -a vX.Y.Z -m "vX.Y.Z" |
| 167 | +git push origin vX.Y.Z |
| 168 | +gh release create vX.Y.Z --title "vX.Y.Z" --notes-from-tag |
| 169 | + |
| 170 | +# 6. publish |
| 171 | +cargo publish |
| 172 | + |
| 173 | +# 7. verify |
| 174 | +cargo search typerush |
| 175 | +``` |
0 commit comments