From 36f6149be189c6b4ac5bd501568b3682acfcf3a1 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 9 Sep 2022 11:21:24 -0700 Subject: [PATCH] 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. --- ci/build/release-prep.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ci/build/release-prep.sh b/ci/build/release-prep.sh index 9e52d245e..0960414ca 100755 --- a/ci/build/release-prep.sh +++ b/ci/build/release-prep.sh @@ -9,6 +9,9 @@ set -euo pipefail +CHECKMARK="\xE2\x9C\x94" +DASH="-" + main() { if [ "${DRY_RUN-}" = 1 ]; then echo "Performing a dry run..." @@ -76,11 +79,12 @@ main() { CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version") # Ask which version we should update to # In the future, we'll automate this and determine the latest version automatically - echo "Current version: ${CODE_SERVER_CURRENT_VERSION}" + echo -e "$DASH Current version: ${CODE_SERVER_CURRENT_VERSION}" # The $'\n' adds a line break. See: https://stackoverflow.com/a/39581815/3015595 - read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE + CODE_SERVER_VERSION_TO_UPDATE=$(git rev-parse --abbrev-ref HEAD | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/') + echo -e "$CHECKMARK Version in branch name" + echo -e "$CHECKMARK Updating to: $CODE_SERVER_VERSION_TO_UPDATE" - echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n" $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" $CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"