| 1 |
# How to do a release |
| 2 |
|
| 3 |
## Update changelog and Cargo versions |
| 4 |
|
| 5 |
Send a PR similar to <https://github.com/jj-vcs/jj/pull/7954>. Feel free to |
| 6 |
copy-edit the changelog in order to: |
| 7 |
|
| 8 |
* Populate "Release highlights" if relevant |
| 9 |
* Put more important items first so the reader doesn't miss them |
| 10 |
* Make items consistent when it comes to language and formatting |
| 11 |
* Catch any misplaced changelog items by looking at the CHANGELOG diff. |
| 12 |
|
| 13 |
To get the CHANGELOG diff, you can run |
| 14 |
|
| 15 |
```shell |
| 16 |
jj log -r 'heads(tags())' # Check that this shows the previous version |
| 17 |
jj diff --from 'heads(tags())' --to main CHANGELOG.md |
| 18 |
``` |
| 19 |
|
| 20 |
Make sure to add a corresponding reference link at the bottom of the |
| 21 |
CHANGELOG for the new version's tag. It should be the GitHub URL comparing |
| 22 |
the previous version tag with the new version tag |
| 23 |
(e.g. `https://github.com/jj-vcs/jj/compare/v0.32.0...v0.33.0`). Also update the |
| 24 |
`[unreleased]` link accordingly, comparing the newest version against `HEAD`. |
| 25 |
|
| 26 |
Producing the list of contributors is a bit annoying. The current suggestion is |
| 27 |
to run something like this: |
| 28 |
|
| 29 |
```shell |
| 30 |
root=$(jj log -G -r 'heads(tags(glob:"v*.*.*") & ::trunk())' -T commit_id) |
| 31 |
filter=' |
| 32 |
map(.commits[] | select(.author.login | (. != null and endswith("[bot]") | not))) |
| 33 |
| unique_by(if .author.login != null then .author.login else .author.email end) |
| 34 |
| map(if .author.login != null |
| 35 |
then "* \(.commit.author.name) (@\(.author.login))" |
| 36 |
else "* \(.commit.author.name)" |
| 37 |
end) |
| 38 |
| .[] |
| 39 |
' |
| 40 |
gh api "/repos/jj-vcs/jj/compare/$root...main" --paginate | jq -sr "$filter" | sort -f |
| 41 |
``` |
| 42 |
|
| 43 |
<https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits> |
| 44 |
|
| 45 |
Alternatively, the list can be produced locally: |
| 46 |
|
| 47 |
```shell |
| 48 |
jj log -G -r 'heads(tags())..main' -T '"* " ++ author ++ "\n"' | sort -fu |
| 49 |
``` |
| 50 |
|
| 51 |
Then try to find the right GitHub username for each person and copy their name |
| 52 |
and username from the GitHub page for the person |
| 53 |
(e.g. <https://github.com/martinvonz>). |
| 54 |
|
| 55 |
Get the PR through review and get it merged as usual. |
| 56 |
|
| 57 |
## Create a tag and a GitHub release |
| 58 |
|
| 59 |
1. Go to <https://github.com/jj-vcs/jj/releases> and click "Draft a new release" |
| 60 |
2. Click "Choose a tag" and enter "v0.\<number\>.0" (e.g. "v0.26.0") to create a |
| 61 |
new tag |
| 62 |
3. Click "Target", then "Recent commits", and select the commit from your merged |
| 63 |
PR |
| 64 |
4. Use the name (e.g. "v0.26.0") as "Release title". Paste the changelog entries |
| 65 |
into the message body |
| 66 |
5. Check "Create a discussion for this release" |
| 67 |
6. Click "Publish release" |
| 68 |
|
| 69 |
## Publish the crates to crates.io |
| 70 |
|
| 71 |
Go to a terminal and create a new clone of the repo [^1]: |
| 72 |
|
| 73 |
```shell |
| 74 |
cd $(mktemp -d) |
| 75 |
jj git clone https://github.com/jj-vcs/jj |
| 76 |
cd jj |
| 77 |
jj new v0.<number>.0 |
| 78 |
``` |
| 79 |
|
| 80 |
Publish each crate: |
| 81 |
|
| 82 |
```shell |
| 83 |
cargo publish --workspace |
| 84 |
``` |
| 85 |
|
| 86 |
[^1]: We recommend publishing from a new clone because `cargo publish` will |
| 87 |
archive ignored files if they match the patterns in `[include]` |
| 88 |
([example](https://github.com/jj-vcs/jj/blob/b95628c398c6c3d11f41bdf53d0aef11f92ee96d/lib/Cargo.toml#L15-L22)), |
| 89 |
so it's a security risk to run it in an existing clone where you may have |
| 90 |
left sensitive content in an ignored file. |