2021-04-21 16:58:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SRC=$(dirname $0)
|
|
|
|
|
|
|
|
cd $SRC
|
|
|
|
|
|
|
|
ARG=${1:-""}
|
|
|
|
|
|
|
|
|
|
|
|
case $ARG in
|
|
|
|
build)
|
|
|
|
python3 -m pip install --upgrade setuptools wheel
|
|
|
|
python3 setup.py sdist bdist_wheel
|
|
|
|
python3 -m pip install --upgrade twine
|
|
|
|
python3 -m twine upload --repository testpypi dist/*
|
|
|
|
;;
|
|
|
|
|
|
|
|
review)
|
|
|
|
gh pr create -f
|
|
|
|
;;
|
|
|
|
|
|
|
|
release)
|
|
|
|
# CURRENT_VERSION=$(cat tg/__init__.py | grep version | cut -d '"' -f 2)
|
|
|
|
CURRENT_VERSION=$(python3 -c 'import tg; print(tg.__version__, end="")')
|
|
|
|
echo Current version $CURRENT_VERSION
|
|
|
|
|
|
|
|
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1 "." $2+1 "." $3}')
|
|
|
|
echo New version $NEW_VERSION
|
2021-04-22 08:12:47 +00:00
|
|
|
sed -i '' "s|$CURRENT_VERSION|$NEW_VERSION|g" tg/__init__.py
|
2021-04-21 16:58:02 +00:00
|
|
|
|
|
|
|
git add -u tg/__init__.py
|
2021-04-21 16:59:21 +00:00
|
|
|
git commit -m "Release v$NEW_VERSION"
|
|
|
|
git tag v$NEW_VERSION
|
2021-04-21 16:58:02 +00:00
|
|
|
|
|
|
|
flit publish
|
2021-04-21 16:59:21 +00:00
|
|
|
git log --pretty=format:"%cn: %s" v$CURRENT_VERSION...v$NEW_VERSION | grep -v -e "Merge" | grep -v "Release"| awk '!x[$0]++' > changelog.md
|
2021-04-21 16:58:02 +00:00
|
|
|
git push origin master --tags
|
2021-04-21 16:59:21 +00:00
|
|
|
gh release create v$NEW_VERSION -F changelog.md
|
2021-04-21 17:00:50 +00:00
|
|
|
rm changelog.md
|
2021-04-21 16:58:02 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
check)
|
|
|
|
black .
|
|
|
|
isort tg/*.py
|
|
|
|
sh check.sh
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
python3 -m tg
|
|
|
|
;;
|
|
|
|
esac
|