update release script

This commit is contained in:
Nick Sweeting 2020-07-28 06:17:54 -04:00
parent bc180bb0cb
commit 2e6837d748

View file

@ -11,10 +11,26 @@ set -o pipefail
IFS=$'\n'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
VERSION_FILE="$DIR/archivebox/VERSION"
function bump_semver {
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
}
source "$DIR/.venv/bin/activate"
cd "$DIR"
OLD_VERSION="$(cat "$VERSION_FILE")"
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
if [ -z "$(git status --porcelain)" ]; then
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
echo "$NEW_VERSION" > "$VERSION_FILE"
else
echo "[X] Commit your changes and make sure the Git state is clean before proceeding."
exit 4
fi
echo "[*] Fetching latest docs version"
cd "$DIR/docs"
git pull
@ -23,12 +39,6 @@ echo "[*] Cleaning up build dirs"
cd "$DIR"
rm -Rf build dist
echo "[*] Bumping VERSION number"
nano "$DIR/archivebox/VERSION"
echo "[*] Building sdist and bdist_wheel"
python3 setup.py sdist bdist_wheel
echo "[*] Building sdist and bdist_wheel"
python3 setup.py sdist bdist_wheel
@ -38,4 +48,4 @@ python3 -m twine upload --repository testpypi dist/*
echo "[^] Uploading to pypi.org"
python3 -m twine upload --repository pypi dist/*
echo "[√] Done. Now at version $(cat "$DIR/archivebox/VERSION")"
echo "[√] Done. Published version v$NEW_VERSION"