Skip to content

Commit 36f6149

Browse files
committed
refactor: use branch name in release-prep
This makes a minor improvement to the `release-prep.sh` script to grab the version to update to from the branch name.
1 parent a7777ff commit 36f6149

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ci/build/release-prep.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
set -euo pipefail
1111

12+
CHECKMARK="\xE2\x9C\x94"
13+
DASH="-"
14+
1215
main() {
1316
if [ "${DRY_RUN-}" = 1 ]; then
1417
echo "Performing a dry run..."
@@ -76,11 +79,12 @@ main() {
7679
CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version")
7780
# Ask which version we should update to
7881
# In the future, we'll automate this and determine the latest version automatically
79-
echo "Current version: ${CODE_SERVER_CURRENT_VERSION}"
82+
echo -e "$DASH Current version: ${CODE_SERVER_CURRENT_VERSION}"
8083
# The $'\n' adds a line break. See: https://stackoverflow.com/a/39581815/3015595
81-
read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE
84+
CODE_SERVER_VERSION_TO_UPDATE=$(git rev-parse --abbrev-ref HEAD | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')
85+
echo -e "$CHECKMARK Version in branch name"
86+
echo -e "$CHECKMARK Updating to: $CODE_SERVER_VERSION_TO_UPDATE"
8287

83-
echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n"
8488
$CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' -g '!lib/vscode/**' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
8589

8690
$CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"

0 commit comments

Comments
 (0)