Skip to content

Commit 74312da

Browse files
committed
chore: improve the release script
1 parent 8a17a35 commit 74312da

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

scripts/release.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
#!/bin/bash
2-
# Usage: ./scripts/release.sh <version>
2+
# Usage: ./scripts/release.sh
33
set -ex
44

5-
if [ $# -ne 1 ]; then
6-
echo "Usage: ./release.sh <version>"
7-
exit 1
8-
fi
9-
105
# Prechecks
116
if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
127
echo "You must be on the main branch to release"
@@ -15,14 +10,21 @@ fi
1510
git diff --exit-code
1611

1712
# Bump version
18-
NEW_VERSION=$1
13+
NEW_VERSION=$(cat .codspeed-runner-version)
1914
# verify that NEW_VERSION is a valid semver
2015
if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
2116
echo "Version must be a valid semver (e.g. 1.2.3)"
2217
exit 1
2318
fi
2419
MAJOR_VERSION=$(echo $NEW_VERSION | cut -d. -f1)
2520

21+
# Ask for confirmation
22+
read -p "Are you sure you want to release v$NEW_VERSION? Bumping the v$MAJOR_VERSION major version ?(y/n) " -n 1 -r
23+
echo
24+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
25+
exit 1
26+
fi
27+
2628
# Fail if there are any unstaged changes left
2729
git diff --exit-code
2830
git commit -m "Release v$NEW_VERSION 🚀" --allow-empty
@@ -31,4 +33,7 @@ git tag -s -fa v$MAJOR_VERSION -m "Release v$NEW_VERSION 🚀"
3133
git push origin tag v$NEW_VERSION
3234
git push -f origin tag v$MAJOR_VERSION
3335
git push --follow-tags
34-
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
36+
37+
RUNNER_NOTES=$(gh release view v$NEW_VERSION -R CodSpeedHQ/runner --json body | jq -r .body)
38+
RUNNER_NOTES="$RUNNER_NOTES\n\nFull Runner Changelog: https://github.com/CodSpeedHQ/runner/blob/main/CHANGELOG.md"
39+
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --notes "$RUNNER_NOTES" -d

0 commit comments

Comments
 (0)