|
| 1 | ++++ |
| 2 | +title = "Releasing in Linebender projects" |
| 3 | ++++ |
| 4 | + |
| 5 | +Several Linebender packages are published to [crates.io](https://crates.io). |
| 6 | +When we do so, we follow a process to ensure that: |
| 7 | + |
| 8 | +- All release steps are reviewed. |
| 9 | +- There is consensus that the project is ready for a release. |
| 10 | +- Our users are made aware that a release has happened, and what has changed in the release. |
| 11 | + |
| 12 | +For backports, see the [Backports in Linebender Projects](@/wiki/process/backports.md) post |
| 13 | + |
| 14 | +## Before the release |
| 15 | + |
| 16 | +### Preparing for a release |
| 17 | + |
| 18 | +We should make sure that the changelog accurately reflects all important changes since the previous release. |
| 19 | +It's especially important that we capture all breaking changes. |
| 20 | +This happens as a normal PR, following normal processes. |
| 21 | +We want to have any updates to the changelog content happen before the release PR itself (see [Preparing the release](#preparing-the-release)). |
| 22 | +This is primarily because changelog content updates are more likely to run into merge conflicts. |
| 23 | + |
| 24 | +### Dependencies |
| 25 | + |
| 26 | +We make sure that all dependencies are at their latest version. |
| 27 | +This is achieved by running: |
| 28 | + |
| 29 | +```sh |
| 30 | +# Updates dependencies in Cargo.toml files. |
| 31 | +cargo upgrade --ignore-rust-version |
| 32 | +# Updates Cargo.lock to match what new users who add our crate will use. |
| 33 | +# This ensures our testing is realistic. |
| 34 | +cargo update --ignore-rust-version |
| 35 | +``` |
| 36 | + |
| 37 | +You should also check that the `cargo upgrade` output doesn't list any breaking releases of our dependencies. |
| 38 | +Note that we have a public dependency on some crates (especially wgpu), which we want to keep synchronised across our projects. |
| 39 | + |
| 40 | +This will be submitted as a PR, following normal processes. |
| 41 | + |
| 42 | +See [rfcs#5](https://github.com/linebender/rfcs/blob/main/rfcs/0005-version-matrix.md#cargolock-is-updated-regularly) for motivation of this strategy. |
| 43 | + |
| 44 | +### Preparing the release |
| 45 | + |
| 46 | +Anyone can prepare the release PR (although it should be an organisation member). |
| 47 | +The PR which makes a release should *only* bump version numbers in Cargo.toml (and Cargo.lock) files, and update the changelog as described below. |
| 48 | + |
| 49 | +To validate the release, you can run: `cargo publish -p {crate1} -p {crate2} --dry-run`. |
| 50 | +At this stage, you should *only* be doing a dry run. |
| 51 | +Cargo should probably not be logged into crates.io at this stage. |
| 52 | + |
| 53 | +The updates required in the changelog are as follows: |
| 54 | + |
| 55 | +- The release header for the new release should be created. |
| 56 | + You should duplicate the copy the MSRV of the unreleased version. |
| 57 | + This should create a new header for the release, between the two MSRV lines, which will look something like: |
| 58 | + |
| 59 | + ```md |
| 60 | + ## [v{x.x.x}][] - 202{x}-{xx}-{xx} |
| 61 | + ``` |
| 62 | + |
| 63 | +- That is, the final result should look something like: |
| 64 | + |
| 65 | + ```md |
| 66 | + ## [Unreleased][] |
| 67 | + |
| 68 | + This release has an [MSRV][] of 1.82. |
| 69 | + |
| 70 | + ## [0.3.2][] (2025-09-10) |
| 71 | + |
| 72 | + This release has an [MSRV][] of 1.82. |
| 73 | + |
| 74 | + ### Added |
| 75 | + ``` |
| 76 | + |
| 77 | +- The paragraph at the top should be updated. |
| 78 | + This involves updating all of: the latest release number, the link from that number to the release's header, the date of the release in the text, and the link for the text "documented below". |
| 79 | +- The links at the bottom need to be updated. |
| 80 | + This involves adding a new link to the changes for the new release, and updating the unreleased link to be "from" the new tag. |
| 81 | + |
| 82 | +It's recommended to run [markdownlint](https://github.com/DavidAnson/markdownlint) on the resultant changelog, to ensure that all links are up-to-date. |
| 83 | +The author does this through the `DavidAnson.vscode-markdownlint` VSCode extension, but other ways of running it are available. |
| 84 | + |
| 85 | +Note: Linebender uses the current date in the UTC time zone for release dates in changelogs. |
| 86 | +In the evening in America this might be the next day than the one in your calendar, and for the morning in Australia, this might be the previous day. |
| 87 | + |
| 88 | +## Releasing |
| 89 | + |
| 90 | +Release pull requests are an exception to our "author merges" policy. |
| 91 | +Instead release PRs can only be merged by someone who has release permissions, and who will then perform the release once the PR is merged. |
| 92 | + |
| 93 | +### Checking permissions |
| 94 | + |
| 95 | +The person who is making the release needs all of the following permissions: |
| 96 | + |
| 97 | +- Ownership of the crate on crates.io. |
| 98 | + This can be checked by navigating to the crate's page on crates.io, and seeing if the publisher is listed as an owner. |
| 99 | +- The "maintain" role on the corresponding repository. |
| 100 | + This allows them to make the release's tag and GitHub release. |
| 101 | + <!-- The author is an org admin, so there aren't any repos I don't have this maintain access to --> |
| 102 | + TODO: How can you check this beforehand? |
| 103 | + |
| 104 | +### Checking the dates |
| 105 | + |
| 106 | +The release date in the changelog should be updated to the correct current date just before merging. |
| 107 | +This person performing the release should do this step, not the PR author. |
| 108 | + |
| 109 | +Note: Linebender uses the current date in the UTC time zone. |
| 110 | +In the evening in America this might be the next day than the one in your calendar, and for the morning in Australia, this might be the previous day. |
| 111 | + |
| 112 | +### Merging the release PR |
| 113 | + |
| 114 | +The release PR should be merged, after it has been approved. |
| 115 | +This will use our standard merge queue. |
| 116 | +The merge will be queued by the person performing the release. |
| 117 | + |
| 118 | +### Validating correct commit |
| 119 | + |
| 120 | +Once the release PR has been merged, you should check out the main branch, and pull from it. |
| 121 | +You should also validate that the current checked out commit `git rev-parse --short HEAD` matches the newly created commit on main (e.g. through the GitHub web interface, using `gh repo view --web`). |
| 122 | + |
| 123 | +### Publishing |
| 124 | + |
| 125 | +You are now ready to perform the publish. |
| 126 | +As a security best practice, you should only log `cargo` into crates.io whilst making releases. |
| 127 | +The author uses 1Password to achieve this, but alternatively making a short-lived token on crates.io as you make a release is also an acceptable way to achieve this. |
| 128 | +Note that we don't enforce this. |
| 129 | + |
| 130 | +If you're publishing multiple crates at once, you should publish using `cargo publish -p {crate1} -p {crate2}`. |
| 131 | +This ensures that each of the crates will compile successfully. |
| 132 | + |
| 133 | +For new crates, we make sure that at least three Linebender organisation members have publish permissions. |
| 134 | +This should include Raph, and at least one organisation admin. |
| 135 | +Ask on Zulip if you're unsure about this step. |
| 136 | + |
| 137 | +### GitHub release |
| 138 | + |
| 139 | +We also create a GitHub release and git tag for each release. |
| 140 | +The easiest way to do both is through GitHub's web interface. |
| 141 | + |
| 142 | +- You should navigate to the repo's main page, and click "Tags", then navigate to the "releases" tab. |
| 143 | +- From there, you should press "Draft a new release" |
| 144 | +- In this page, you should enter the name of the new tag in the "Tag: Select tag" dropdown, pressing the "create new tag" option. |
| 145 | +- Select the previous tag, then press "Generate release notes". |
| 146 | + We do this for the release title, new contributors and "Full Changelog" links. |
| 147 | + Remove the What's changed section. |
| 148 | +- Add: |
| 149 | + - The crates.io/docs.rs links to the top of the page |
| 150 | + |
| 151 | + ```md |
| 152 | + **[Crates.io](https://crates.io/crates/{package_name}/{x.x.x}) | [Docs](https://docs.rs/{package_name}/{x.x.x})** |
| 153 | + ``` |
| 154 | + |
| 155 | + You should be able to validate the crates.io link now, although the docs job will likely not have completed yet. |
| 156 | + |
| 157 | + - Beneath this, copy in the relevant section from the changelog (including the MSRV), with the following transformations: |
| 158 | + - The section headings should be kept at the same level (i.e. level 3) |
| 159 | + - All of the links to PRs (e.g. [`[#123][]`]) should be changed into just PR references (`#123`). |
| 160 | + This means that GitHub will show a card for the PR for people who view the release in the web interface. |
| 161 | + - All of the links to authors (e.g. [`[@raphlinus][]`]) should be changed into normal mentions (`@raphlinus`). |
| 162 | + This means that GitHub will show a card for the user for people who view the release in the web interface. |
| 163 | + - An MSRV link definition should be added at the bottom. This is the same in all our repositories: |
| 164 | + |
| 165 | + ```md |
| 166 | + [MSRV]: README.md#minimum-supported-rust-version-msrv |
| 167 | + ``` |
| 168 | + |
| 169 | +Once this is done, the GitHub release can be created. |
| 170 | + |
| 171 | +### Zulip message |
| 172 | + |
| 173 | +We also share releases on the [Linebender Zulip](https://xi.zulipchat.com/). |
| 174 | +The format for this message is: |
| 175 | + |
| 176 | +```md |
| 177 | +{Crate Name} v{x.x.x} is out now: |
| 178 | + |
| 179 | +- [GitHub Release](URL of the release on GitHub) |
| 180 | +- [Crates.io](https://crates.io/crates/{package_name}/{x.x.x}) |
| 181 | +- [Docs](https://docs.rs/{package_name}/{x.x.x}) |
| 182 | +``` |
| 183 | + |
| 184 | +The format can be slightly different if the release involves multiple packages. |
| 185 | +See the message sent for the previous release for that project in this case. |
| 186 | + |
| 187 | +We also occasionally share releases on Mastodon. |
| 188 | + |
| 189 | +## Checklist |
| 190 | + |
| 191 | +<fieldset> |
| 192 | + |
| 193 | +<legend>Before Release</legend> |
| 194 | + |
| 195 | +<div> |
| 196 | +<input type="checkbox" id="before-dependencies"></input><label for="before-dependencies">Dependencies up-to-date.</label> |
| 197 | +</div> |
| 198 | + |
| 199 | +<div> |
| 200 | +<input type="checkbox" id="before-changelog"></input><label for="before-changelog">Changelog up-to-date.</label> |
| 201 | +</div> |
| 202 | + |
| 203 | +<div> |
| 204 | +<input type="checkbox" id="before-version-number"></input><label for="before-version-number">Version numbers bumped in Cargo.toml. Publish <b>dry run</b> performed.</label> |
| 205 | +</div> |
| 206 | + |
| 207 | +<div> |
| 208 | +<input type="checkbox" id="before-changelog-links"></input><label for="before-changelog-links">All parts of the changelog updated, and markdownlint ran.</label> |
| 209 | +</div> |
| 210 | + |
| 211 | +</fieldset> |
| 212 | + |
| 213 | +<fieldset> |
| 214 | + |
| 215 | +<legend>During Release</legend> |
| 216 | + |
| 217 | +<div> |
| 218 | +<input type="checkbox" id="during-permissions"></input><label for="during-permissions">Correct permissions validated.</label> |
| 219 | +</div> |
| 220 | + |
| 221 | +<div> |
| 222 | +<input type="checkbox" id="during-date"></input><label for="during-date">Release date in changelog updated to today's date (in UTC). markdownlint executed.</label> |
| 223 | +</div> |
| 224 | + |
| 225 | +<div> |
| 226 | +<input type="checkbox" id="during-merged"></input><label for="during-merged">Release PR merged by person who will do the release.</label> |
| 227 | +</div> |
| 228 | + |
| 229 | +<div> |
| 230 | +<input type="checkbox" id="during-checkout"></input><label for="during-checkout">Checked out (and validated) the merged commit on main.</label> |
| 231 | +</div> |
| 232 | + |
| 233 | +<div> |
| 234 | +<input type="checkbox" id="during-published"></input><label for="during-published">Published to crates.io.</label> |
| 235 | +</div> |
| 236 | + |
| 237 | +<div> |
| 238 | +<input type="checkbox" id="during-added-owners"></input><label for="during-added-owners">For new crates only: Additional owners added on crates.io.</label> |
| 239 | +</div> |
| 240 | + |
| 241 | +<div> |
| 242 | +<input type="checkbox" id="during-github-release"></input><label for="during-github-release">Release on GitHub made.</label> |
| 243 | +</div> |
| 244 | + |
| 245 | +<div> |
| 246 | +<input type="checkbox" id="during-zulip"></input><label for="during-zulip">Announcement message sent to the Zulip for the release.</label> |
| 247 | +</div> |
| 248 | + |
| 249 | +</fieldset> |
0 commit comments