Skip to content

Commit 338e467

Browse files
docs: document new CHANGELOG-management strategy
At the moment, we have to send a separate PR that removes the `- unreleased` suffix in `CHANGELOG.md` before we can make a release. This is annoying and unnecessarily delays being able to make releases for features that have been merged into master. As of libp2p#4620, we have CI checks that ensure we add a changelog entry when a particular crate is modified. Additionally, the CI check also ensures we bump the version in case the top-most one of the changelog is already released. The combination of these checks should ensure that we add a section for the new version in case the top-most one is already released. Previously, the presence of `- unreleased` would notify us of that. In the future, we can add a CI job that allows us to release at the press of a button (think `workflow_dispatch`). Until then, this setup should already make it much easier to release crates. Pull-Request: libp2p#4894.
1 parent 7387500 commit 338e467

File tree

6 files changed

+20
-27
lines changed

6 files changed

+20
-27
lines changed

docs/release.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,34 @@ Non-breaking changes are typically merged very quickly and often released as pat
1717

1818
Every crate that we publish on `crates.io` has a `CHANGELOG.md` file.
1919
Substantial PRs should add an entry to each crate they modify.
20-
The next unreleased version is tagged with ` - unreleased`, for example: `0.17.0 - unreleased`.
20+
We have a CI check[^1] that enforces adding a changelog entry if you modify code in a particular crate.
21+
In case the current version is already released (we also check that in CI), you'll have to add a new header at the top.
22+
For example, the top-listed version might be `0.17.3` but it is already released.
23+
In that case, add a new heading `## 0.17.4` with your changelog entry in case it is a non-breaking change.
2124

22-
In case there isn't a version with an ` - unreleased` postfix yet, add one for the next version.
23-
The next version number depends on the impact of your change (breaking vs non-breaking, see above).
24-
25-
If you are making a non-breaking change, please also bump the version number:
26-
27-
- in the `Cargo.toml` manifest of the respective crate
28-
- in the `[workspace.dependencies]` section of the workspace `Cargo.toml` manifest
29-
30-
For breaking changes, a changelog entry itself is sufficient.
31-
Bumping the version in the `Cargo.toml` file would lead to many merge conflicts once we decide to merge them.
32-
Hence, we are going to bump those versions once we work through the milestone that collects the breaking changes.
25+
The version in the crate's `Cargo.toml` and the top-most version in the `CHANGELOG.md` file always have to be in sync.
26+
Additionally, we also enforce that all crates always depend on the latest version of other workspace-crates through workspace inheritance.
27+
As a consequence, you'll also have to bump the version in `[workspace.dependencies]` in the workspace `Cargo.toml` manifest.
3328

3429
## Releasing one or more crates
3530

31+
The above changelog-management strategy means `master` is always in a state where we can make a release.
32+
3633
### Prerequisites
3734

3835
- [cargo release](https://github.com/crate-ci/cargo-release/)
3936

4037
### Steps
4138

42-
1. Remove the ` - unreleased` tag for each crate to be released in the respective `CHANGELOG.md`.
43-
Create a pull request with the changes against the rust-libp2p `master` branch.
44-
45-
2. Once merged, run the two commands below on the (squash-) merged commit on the `master` branch.
39+
1. Run the two commands below on the (squash-) merged commit on the `master` branch.
4640

4741
1. `cargo release publish --execute`
4842

4943
2. `cargo release tag --sign-tag --execute`
5044

51-
3. Confirm that `cargo release` tagged the commit correctly via `git push
52-
$YOUR_ORIGIN --tag --dry-run` and then push the new tags via `git push
53-
$YOUR_ORIGIN --tag`. Make sure not to push unrelated git tags.
54-
55-
Note that dropping the `--no-push` flag on `cargo release` might as well do
56-
the trick.
45+
2. Confirm that `cargo release` tagged the commit correctly via `git push $YOUR_ORIGIN --tag --dry-run`
46+
Push the new tags via `git push $YOUR_ORIGIN --tag`.
47+
Make sure not to push unrelated git tags.
5748

5849
## Patch release
5950

@@ -77,3 +68,5 @@ To avoid accidental breaking changes for our users, we employ the following conv
7768
Example: `0.1.0-alpha` to `0.2.0-alpha`.
7869
- For a non-breaking change in a crate with an alpha release, bump or append number to the "alpha" tag.
7970
Example: `0.1.0-alpha` to `0.1.0-alpha.1`.
71+
72+
[^1]: See [ci.yml](../.github/workflows/ci.yml) and look for "Ensure manifest and CHANGELOG are properly updated".

protocols/gossipsub/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.46.1 - unreleased
1+
## 0.46.1
22

33
- Deprecate `Rpc` in preparation for removing it from the public API because it is an internal type.
44
See [PR 4833](https://github.com/libp2p/rust-libp2p/pull/4833).

protocols/identify/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.44.1 - unreleased
1+
## 0.44.1
22

33
- Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated.
44
See [PR 4596](https://github.com/libp2p/rust-libp2p/pull/4596).

protocols/kad/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.45.2 - unreleased
1+
## 0.45.2
22

33
- Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated.
44
See [PR 4596](https://github.com/libp2p/rust-libp2p/pull/4596).

protocols/mdns/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.45.1 - unreleased
1+
## 0.45.1
22

33
- Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated.
44
See [PR 4596](https://github.com/libp2p/rust-libp2p/pull/4596).

scripts/add-changelog-header.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ if [[ $header == $prefix* ]]; then
77
exit
88
fi
99

10-
sed -i "1i ## ${NEW_VERSION} - unreleased\n\n" "$CRATE_ROOT/CHANGELOG.md"
10+
sed -i "1i ## ${NEW_VERSION}\n\n" "$CRATE_ROOT/CHANGELOG.md"

0 commit comments

Comments
 (0)