Skip to content

Commit fb96054

Browse files
committed
Update release script
1 parent 5b67bf8 commit fb96054

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

release.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,29 @@ cd "$root"
77
sub='{ s/^.*["'"'"']\([0-9]*\.[0-9]*\.[0-9]*\)["'"'"'].*$/\1/;p; }'
88
old1=$(sed -n -e '/version *=/'"$sub"'' python/setup.py)
99
old2=$(sed -n -e '/"version" *:/'"$sub"'' nodejs/package.json)
10-
11-
if [ "$old1" != "$old2" ]; then
10+
if [[ "$old1" != "$old2" ]]; then
1211
echo "Versions aren't the same: $old1 != $old2" 1>&2
1312
exit 1
1413
fi
15-
IFS=. v=($old1)
16-
new="${v[0]}.${v[1]}.$((${v[2]} + 1))"
1714

18-
sub='s/\(["'"'"']\)'"$old1"'["'"'"']/\1'"$new"'\1/'
19-
sed -i~ -e '/version *=/'"$sub" python/setup.py
20-
sed -i~ -e '/"version" *:/'"$sub" nodejs/package.json
15+
case "$1" in
16+
+)
17+
IFS=. v=($old1)
18+
new="${v[0]}.${v[1]}.$((${v[2]} + 1))"
19+
20+
sub='s/\(["'"'"']\)'"$old1"'["'"'"']/\1'"$new"'\1/'
21+
sed -i~ -e '/version *=/'"$sub" python/setup.py
22+
sed -i~ -e '/"version" *:/'"$sub" nodejs/package.json
23+
;;
24+
25+
=)
26+
new="$old1"
27+
;;
28+
*)
29+
echo "Publish current version: $0 =" 1>&2
30+
echo "Increment version and publish: $0 +" 1>&2
31+
exit 2
32+
esac
2133

2234
pushd "$root"/python
2335
python setup.py sdist
@@ -28,6 +40,8 @@ pushd "$root"/nodejs
2840
npm publish
2941
popd
3042

31-
git commit -m "Update version to $new" python/setup.py nodejs/package.json
43+
if [[ "$1" == "+" ]]; then
44+
git commit -m "Update version to $new" python/setup.py nodejs/package.json
45+
fi
3246
git tag -a v"$new" -m "Release version $new"
3347
git push origin v"$new"

0 commit comments

Comments
 (0)