Skip to content

Commit 64c0104

Browse files
committed
Sorry, Perl
1 parent 87a576b commit 64c0104

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

scripts/bump-version.sh

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

4-
if [ "$(uname -s)" != "Linux" ]; then
5-
echo "Please use the GitHub Action."
6-
exit 1
7-
fi
8-
9-
SCRIPT_DIR="$( dirname "$0" )"
10-
cd $SCRIPT_DIR/..
4+
cd "$(dirname "$0")/.."
115

126
OLD_VERSION="${1}"
137
NEW_VERSION="${2}"
@@ -16,9 +10,10 @@ echo "Current version: $OLD_VERSION"
1610
echo "Bumping version: $NEW_VERSION"
1711

1812
function replace() {
19-
! grep "$2" $3
20-
perl -i -pe "s/$1/$2/g" $3
21-
grep "$2" $3 # verify that replacement was successful
13+
! grep "$2" "$3"
14+
sed -e "s/$1/$2/g" "$3" > "$3.tmp" # -i is non-portable
15+
mv "$3.tmp" "$3"
16+
grep "$2" "$3" # verify that replacement was successful
2217
}
2318

24-
replace "version=\"[0-9.]+\"" "version=\"$NEW_VERSION\"" ./setup.py
19+
replace "version='[^']*'" "version='$NEW_VERSION'" ./setup.py

0 commit comments

Comments
 (0)