Skip to content

Commit 42cc5d6

Browse files
committed
Support RCs in bump-version.sh script
1 parent 7f8442e commit 42cc5d6

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

scripts/bump-version.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -eux
33

4-
SCRIPT_DIR="$( dirname "$0" )"
4+
SCRIPT_DIR="$(dirname "$0")"
55
cd $SCRIPT_DIR/..
66

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

1313
function replace() {
14-
! grep "$2" $3
15-
perl -i -pe "s/$1/$2/g" $3
16-
grep "$2" $3 # verify that replacement was successful
14+
local _path="$3"
15+
16+
if grep "$2" "$_path" >/dev/null; then
17+
echo "Version already bumped to $NEW_VERSION"
18+
exit 1
19+
fi
20+
21+
perl -i -pe "s/$1/$2/g" "$3"
22+
23+
# Verify that replacement was successful
24+
if ! grep "$2" "$3"; then
25+
echo "Failed to bump version"
26+
exit 1
27+
fi
1728
}
1829

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

0 commit comments

Comments
 (0)