Skip to content

Commit 644f798

Browse files
committed
v0.1.1
1 parent c61c595 commit 644f798

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

python/publish.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# get new version from __init__.py
6+
new_version=$(grep --color=never -oP '__version__\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' "src/deglib/__init__.py")
7+
echo "detected new version: $new_version"
8+
9+
# get old version from pypi
10+
old_version=$(curl -s "https://pypi.org/pypi/deglib/json" | jq -r '.info.version')
11+
12+
# compare versions
13+
if [ "$old_version" = "$new_version" ]; then
14+
echo "ERROR: current version equals version on pypi"
15+
read -p "have you changed the version in \"src/deglib/__init__.py\"? y/[n]: " answer
16+
if [ "$answer" != "y" ]; then
17+
exit 0
18+
fi
19+
fi
20+
21+
# publish
22+
git add -A && git commit -m "v$new_version" && git tag -a "v$new_version" -m "v$new_version"
23+
git push && git push origin --tags

0 commit comments

Comments
 (0)