Archived
1
0

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.
This commit is contained in:
Joe Previte 2022-09-09 11:21:24 -07:00
parent a7777ffa42
commit 36f6149be1
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -9,6 +9,9 @@
set -euo pipefail set -euo pipefail
CHECKMARK="\xE2\x9C\x94"
DASH="-"
main() { main() {
if [ "${DRY_RUN-}" = 1 ]; then if [ "${DRY_RUN-}" = 1 ]; then
echo "Performing a dry run..." echo "Performing a dry run..."
@ -76,11 +79,12 @@ main() {
CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version") CODE_SERVER_CURRENT_VERSION=$(node -pe "require('./package.json').version")
# Ask which version we should update to # Ask which version we should update to
# In the future, we'll automate this and determine the latest version automatically # 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 # 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 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" $CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"