Skip to content

Commit 50699f5

Browse files
authored
Update changelog when performing a release. (#8)
* Update changelog when performing a release. * Use conventions from Keep a Changelog: https://keepachangelog.com/en/1.0.0/ * Bugfix PR title. * Switch back to main after a release PR. * Clarify that release levels are applyed after the release.
1 parent dcd0281 commit 50699f5

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

release/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ Optionally, if you want to have a GitHub Pull-Request automatically created, you
2222

2323
Go to the folder containing a Cargo workspace or crate and run:
2424

25-
release.sh [major|minor|patch] [false]
25+
release.sh [<next-devel-level>] [false]
26+
27+
where `next-devel-level` is the version level to be increased *after* the release is done. This ca be `major`, `minor` or `patch`.
2628

2729
This pushes two commits in a newly created release branch. When merging, __do not squash them__.
2830

2931
Examples:
3032

31-
# Perform release raise the minor version
33+
# Perform release and raise the minor version afterwards
3234
$ release.sh
3335

3436
# Perform a release but do not push anything to origin
3537
$ release.sh minor false
3638

37-
# Perform a release and raise the major version
39+
# Perform a release and raise the major version for the next development version
3840
$ release.sh major
3941

4042
## Description

release/release.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ maybe_create_github_pr() {
2929
fi
3030
}
3131

32+
update_changelog() {
33+
local RELEASE_VERSION=$1;
34+
35+
TODAY=$(date +'%Y-%m-%d')
36+
37+
sed -i "s/^.*unreleased.*/## [Unreleased]\n\n## [$RELEASE_VERSION] - $TODAY\n/I" CHANGELOG.md
38+
}
39+
3240
main() {
3341

3442
local NEXT_LEVEL=${1:-minor}
@@ -41,22 +49,27 @@ main() {
4149
#
4250
cargo-version.py --release
4351
cargo update --workspace
44-
local TAG=$(cargo-version.py --show)
45-
git commit -am "bump version $TAG"
46-
git tag -a $TAG -m "release $TAG" HEAD
52+
local RELEASE_VERSION=$(cargo-version.py --show)
53+
54+
update_changelog $RELEASE_VERSION
55+
56+
git commit -am "bump version $RELEASE_VERSION"
57+
git tag -a $RELEASE_VERSION -m "release $RELEASE_VERSION" HEAD
4758

4859
#
4960
# Development
5061
#
5162
cargo-version.py --next ${NEXT_LEVEL}
5263
cargo update --workspace
5364
local NEXT_TAG=$(cargo-version.py --show)
65+
5466
git commit -am "bump version $NEXT_TAG"
5567

5668
if [ "$PUSH" = "true" ]; then
5769
git push ${REPOSITORY} ${RELEASE_BRANCH}
5870
git push --tags
59-
maybe_create_github_pr $TAG
71+
maybe_create_github_pr $RELEASE_VERSION
72+
git switch main
6073
fi
6174
}
6275

0 commit comments

Comments
 (0)