-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# get new version from __init__.py | ||
new_version=$(grep --color=never -oP '__version__\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' "src/deglib/__init__.py") | ||
echo "detected new version: $new_version" | ||
|
||
# get old version from pypi | ||
old_version=$(curl -s "https://pypi.org/pypi/deglib/json" | jq -r '.info.version') | ||
|
||
# compare versions | ||
if [ "$old_version" = "$new_version" ]; then | ||
echo "ERROR: current version equals version on pypi" | ||
read -p "have you changed the version in \"src/deglib/__init__.py\"? y/[n]: " answer | ||
if [ "$answer" != "y" ]; then | ||
exit 0 | ||
fi | ||
fi | ||
|
||
# publish | ||
git add -A && git commit -m "v$new_version" && git tag -a "v$new_version" -m "v$new_version" | ||
git push && git push origin --tags |