Skip to content

Commit 3d92093

Browse files
authored
Split releases in two PRs (#24)
* release.sh: Added make regenerate-chart and split release and next into two PRs. * Update README for the release script. * Use different PR messages for release and bump PRs * Update docs and tested.
1 parent eeaab26 commit 3d92093

File tree

2 files changed

+57
-42
lines changed

2 files changed

+57
-42
lines changed

release/README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,27 @@ Optionally, if you want to have a GitHub Pull-Request automatically created, you
1616

1717
## Usage
1818

19-
Go to the folder containing a Cargo workspace or crate and run:
19+
To make a release pull-request, go to the folder containing a Cargo workspace or crate and run:
2020

21-
release.sh [<next-devel-level>] [false]
21+
release.sh release
2222

23-
where `next-devel-level` is the version level to be increased *after* the release is done. This ca be `major`, `minor` or `patch`.
23+
To bump the version and create pull-request:
2424

25-
This pushes two commits in a newly created release branch. When merging, __do not squash them__.
25+
release.sh [<next-devel-level>]
26+
27+
where `next-devel-level` is the version level to be bumped. This ca be `major`, `minor` or `patch`.
28+
29+
This pushes two commits in a newly created release branch.
2630

2731
Examples:
2832

29-
# Perform release and raise the minor version afterwards
30-
$ release.sh
33+
# Perform release
34+
$ release.sh release
3135

32-
# Perform a release but do not push anything to origin
36+
# Bump the minor version but do not push anything to origin
3337
$ release.sh minor false
3438

35-
# Perform a release and raise the major version for the next development version
39+
# Bump the major version, push and make a pull-request
3640
$ release.sh major
3741

3842
## Description
@@ -41,13 +45,15 @@ The release process performs the following steps:
4145
0. Create a release branch from `main`.
4246
1. Update the release version in the cargo workspace by dropping the "-nightly" token.
4347
2. Update `Cargo.lock` with the new version.
44-
3. Commit and tag the release.
45-
4. Set the version to the next development version by increasing the 'minor' (by default) part and adding the '-nightly' prerelease token.
46-
5. Update `Cargo.lock` with the new version.
47-
6. Commit the next release.
48-
7. Push the two commits. This is skipped if the second argument was `false`.
49-
8. __Optional__: if the GitHub cli is installed, a PR is created. This is also skipped if the second argument was `false`.
50-
51-
## Future development
48+
3. Regenerate Helm chart and manifests.
49+
4. Update the CHANGELOG.md entry of this release
50+
5. Commit, tag and push the changes.
51+
6. __Optional__: if the GitHub cli is installed, a PR is created.
5252

53-
Automatically update the change log and readme files.
53+
Raising the next development version includes the following steps:
54+
0. Create a release branch from `main`.
55+
1. Set the version to the next development version by increasing the 'next-devel-level' (by default) part and adding the '-nightly' prerelease token.
56+
2. Update `Cargo.lock` with the new version.
57+
3. Regenerate Helm chart and manifests.
58+
4. Commit and push
59+
5. __Optional__: if the GitHub cli is installed, a PR is created.

release/release.sh

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
#
33
# Usage: release.sh <level>
44
#
55
# <level> : "major", "minor" or "patch". Default: "minor".
66
#
77
set -e
8+
set -x
89

910
BASE_BRANCH="main"
1011
REPOSITORY="origin"
@@ -26,10 +27,10 @@ ensure_release_branch() {
2627
}
2728

2829
maybe_create_github_pr() {
29-
local TAG=$1
30+
local MESSAGE=${1}
3031
GH_COMMAND=$(which gh)
3132
if [ "$GH_COMMAND" != "" ]; then
32-
gh pr create --base $BASE_BRANCH --head $RELEASE_BRANCH --title "Release $TAG" --body "Release $TAG. DO NOT SQUASH MERGE!"
33+
gh pr create --base $BASE_BRANCH --head $RELEASE_BRANCH --title $MESSAGE --body $MESSAGE
3334
fi
3435
}
3536

@@ -38,41 +39,49 @@ update_changelog() {
3839

3940
TODAY=$(date +'%Y-%m-%d')
4041

41-
sed -i "s/^.*unreleased.*/## [Unreleased]\n\n## [$RELEASE_VERSION] - $TODAY\n/I" CHANGELOG.md
42+
sed -i "s/^.*unreleased.*/## [Unreleased]\n\n## [$RELEASE_VERSION] - $TODAY/I" CHANGELOG.md
4243
}
4344

4445
main() {
4546

46-
local NEXT_LEVEL=${1:-minor}
47+
local NEXT_LEVEL=${1:-"release"}
4748
local PUSH=${2:-true}
4849

4950
ensure_release_branch
5051

51-
#
52-
# Release
53-
#
54-
$CARGO_VERSION --release
55-
cargo update --workspace
56-
local RELEASE_VERSION=$($CARGO_VERSION --show)
52+
if [ "$NEXT_LEVEL" == "release" ]; then
53+
#
54+
# Release
55+
#
56+
$CARGO_VERSION --release
57+
cargo update --workspace
58+
make regenerate-charts
59+
local RELEASE_VERSION=$($CARGO_VERSION --show)
60+
61+
update_changelog $RELEASE_VERSION
62+
63+
MESSAGE="release $RELEASE_VERSION"
64+
git commit -am "release $RELEASE_VERSION"
65+
git tag -a $RELEASE_VERSION -m "release $RELEASE_VERSION"
66+
67+
else
68+
#
69+
# Development
70+
#
71+
$CARGO_VERSION --next ${NEXT_LEVEL}
72+
cargo update --workspace
73+
make regenerate-charts
74+
local RELEASE_VERSION=$($CARGO_VERSION --show)
75+
76+
MESSAGE="bump version $RELEASE_VERSION"
77+
git commit -am "bump version $RELEASE_VERSION"
5778

58-
update_changelog $RELEASE_VERSION
59-
60-
git commit -am "bump version $RELEASE_VERSION"
61-
git tag -a $RELEASE_VERSION -m "release $RELEASE_VERSION" HEAD
62-
63-
#
64-
# Development
65-
#
66-
$CARGO_VERSION --next ${NEXT_LEVEL}
67-
cargo update --workspace
68-
local NEXT_TAG=$($CARGO_VERSION --show)
69-
70-
git commit -am "bump version $NEXT_TAG"
79+
fi
7180

7281
if [ "$PUSH" = "true" ]; then
7382
git push ${REPOSITORY} ${RELEASE_BRANCH}
7483
git push --tags
75-
maybe_create_github_pr $RELEASE_VERSION
84+
maybe_create_github_pr $MESSAGE
7685
git switch main
7786
fi
7887
}

0 commit comments

Comments
 (0)