2020-07-28 06:11:30 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
### Bash Environment Setup
|
|
|
|
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
|
|
|
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
|
|
|
# set -o xtrace
|
|
|
|
set -o errexit
|
|
|
|
set -o errtrace
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
IFS=$'\n'
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
2020-07-28 06:17:54 -04:00
|
|
|
VERSION_FILE="$DIR/archivebox/VERSION"
|
|
|
|
|
|
|
|
function bump_semver {
|
|
|
|
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
|
|
|
}
|
2020-07-28 06:11:30 -04:00
|
|
|
|
|
|
|
source "$DIR/.venv/bin/activate"
|
|
|
|
cd "$DIR"
|
|
|
|
|
2020-07-28 06:17:54 -04:00
|
|
|
OLD_VERSION="$(cat "$VERSION_FILE")"
|
|
|
|
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
|
|
|
|
2020-07-28 06:28:58 -04:00
|
|
|
echo "[*] Fetching latest docs version"
|
|
|
|
cd "$DIR/docs"
|
|
|
|
git pull
|
2020-07-28 06:44:58 -04:00
|
|
|
cd "$DIR"
|
|
|
|
|
|
|
|
echo "[+] Building docs"
|
|
|
|
sphinx-apidoc -o docs archivebox
|
|
|
|
cd "$DIR/docs"
|
2020-07-28 06:36:58 -04:00
|
|
|
make html
|
2020-07-28 06:28:58 -04:00
|
|
|
cd "$DIR"
|
|
|
|
|
2020-07-28 07:06:14 -04:00
|
|
|
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
echo "[X] Commit your changes and make sure git is checked out on clean master."
|
|
|
|
exit 4
|
|
|
|
fi
|
2020-07-28 06:17:54 -04:00
|
|
|
|
2020-07-28 06:28:58 -04:00
|
|
|
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
|
|
|
echo "$NEW_VERSION" > "$VERSION_FILE"
|
2020-07-28 07:06:14 -04:00
|
|
|
git add "$VERSION_FILE"
|
2020-07-28 06:28:58 -04:00
|
|
|
git commit -m "$NEW_VERSION release"
|
2020-07-28 07:06:14 -04:00
|
|
|
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
2020-07-28 06:28:58 -04:00
|
|
|
git push origin master
|
|
|
|
git push origin --tags
|
2020-07-28 06:11:30 -04:00
|
|
|
|
|
|
|
echo "[*] Cleaning up build dirs"
|
|
|
|
cd "$DIR"
|
|
|
|
rm -Rf build dist
|
|
|
|
|
2020-07-28 06:44:58 -04:00
|
|
|
echo "[+] Building sdist and bdist_wheel"
|
2020-07-28 06:11:30 -04:00
|
|
|
python3 setup.py sdist bdist_wheel
|
|
|
|
|
|
|
|
echo "[^] Uploading to test.pypi.org"
|
|
|
|
python3 -m twine upload --repository testpypi dist/*
|
|
|
|
|
|
|
|
echo "[^] Uploading to pypi.org"
|
|
|
|
python3 -m twine upload --repository pypi dist/*
|
|
|
|
|
2020-07-28 06:44:58 -04:00
|
|
|
echo "[+] Building docker image"
|
2020-07-28 07:06:14 -04:00
|
|
|
docker build . -t archivebox \
|
|
|
|
-t archivebox:latest \
|
|
|
|
-t archivebox:$NEW_VERSION \
|
|
|
|
-t docker.io/nikisweeting/archivebox:latest \
|
|
|
|
-t docker.io/nikisweeting/archivebox:$NEW_VERSION \
|
|
|
|
-t docker.pkg.github.com/pirate/archivebox/archivebox:latest \
|
|
|
|
-t docker.pkg.github.com/pirate/archivebox/archivebox:$NEW_VERSION
|
2020-07-28 06:44:58 -04:00
|
|
|
|
|
|
|
echo "[^] Uploading docker image"
|
2020-07-28 06:46:13 -04:00
|
|
|
# docker login --username=nikisweeting
|
|
|
|
# docker login docker.pkg.github.com --username=pirate
|
2020-07-28 07:06:14 -04:00
|
|
|
docker push docker.io/nikisweeting/archivebox
|
|
|
|
docker push docker.pkg.github.com/pirate/archivebox/archivebox
|
2020-07-28 06:44:58 -04:00
|
|
|
|
2020-07-28 06:17:54 -04:00
|
|
|
echo "[√] Done. Published version v$NEW_VERSION"
|