Skip to content

Commit

Permalink
Support RCs in bump-version.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Mar 12, 2024
1 parent 7f8442e commit 42cc5d6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eux

SCRIPT_DIR="$( dirname "$0" )"
SCRIPT_DIR="$(dirname "$0")"
cd $SCRIPT_DIR/..

OLD_VERSION="${1}"
Expand All @@ -11,9 +11,20 @@ echo "Current version: $OLD_VERSION"
echo "Bumping version: $NEW_VERSION"

function replace() {
! grep "$2" $3
perl -i -pe "s/$1/$2/g" $3
grep "$2" $3 # verify that replacement was successful
local _path="$3"

if grep "$2" "$_path" >/dev/null; then
echo "Version already bumped to $NEW_VERSION"
exit 1
fi

perl -i -pe "s/$1/$2/g" "$3"

# Verify that replacement was successful
if ! grep "$2" "$3"; then
echo "Failed to bump version"
exit 1
fi
}

replace "\@version \"[0-9.]+\"" "\@version \"$NEW_VERSION\"" ./mix.exs
replace "\@version \"[0-9.rc\-]+\"" "\@version \"$NEW_VERSION\"" ./mix.exs

0 comments on commit 42cc5d6

Please sign in to comment.