Skip to content

Commit f2ab4e5

Browse files
committed
Adding release script
1 parent 99abc9c commit f2ab4e5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

release.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
root=$(cd $(dirname "$0"); pwd -P)
6+
cd "$root"
7+
sub='{ s/^.*["'"'"']\([0-9]*\.[0-9]*\.[0-9]*\)["'"'"'].*$/\1/;p; }'
8+
old1=$(sed -n -e '/version *=/'"$sub"'' python/setup.py)
9+
old2=$(sed -n -e '/"version" *:/'"$sub"'' nodejs/package.json)
10+
11+
if [ "$old1" != "$old2" ]; then
12+
echo "Versions aren't the same: $old1 != $old2" 1>&2
13+
exit 1
14+
fi
15+
IFS=. v=($old1)
16+
new="${v[0]}.${v[1]}.$((${v[2]} + 1))"
17+
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
21+
22+
cd "$root"/python
23+
python setup.py sdist
24+
twine upload dist/http_ece-"$new".tar.gz
25+
26+
cd "$root"/nodejs
27+
npm publish
28+
29+
git commit -m "Update version to $new" python/setup.py nodejs/package.json
30+
git tag v"$new"

0 commit comments

Comments
 (0)