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'
|
|
|
|
|
2020-08-18 15:00:00 -04:00
|
|
|
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
2020-07-28 06:17:54 -04:00
|
|
|
|
2020-08-18 15:00:00 -04:00
|
|
|
cd "$REPO_DIR"
|
2020-11-23 17:28:45 -05:00
|
|
|
source "./.venv/bin/activate"
|
2020-07-28 06:17:54 -04:00
|
|
|
|
2020-07-28 06:28:58 -04:00
|
|
|
|
2020-10-10 16:44:56 -04:00
|
|
|
# Make sure git is clean
|
2020-07-28 07:06:14 -04:00
|
|
|
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
|
|
|
git pull
|
|
|
|
else
|
2020-08-15 01:22:29 -04:00
|
|
|
echo "[!] Warning: git status is dirty!"
|
|
|
|
echo " Press Ctrl-C to cancel, or wait 10sec to continue..."
|
|
|
|
sleep 10
|
2020-07-28 07:06:14 -04:00
|
|
|
fi
|
2020-07-28 06:17:54 -04:00
|
|
|
|
2020-10-10 16:44:56 -04:00
|
|
|
|
|
|
|
# Bump version number in source
|
|
|
|
function bump_semver {
|
|
|
|
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
|
|
|
}
|
|
|
|
|
|
|
|
OLD_VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
|
|
|
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
2020-07-28 06:28:58 -04:00
|
|
|
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
2020-08-18 15:00:00 -04:00
|
|
|
contents="$(jq ".version = \"$NEW_VERSION\"" "$REPO_DIR/package.json")" && \
|
|
|
|
echo "${contents}" > package.json
|
2020-07-28 06:11:30 -04:00
|
|
|
|
|
|
|
|
2020-10-10 16:44:56 -04:00
|
|
|
# Build docs, python package, and docker image
|
|
|
|
./bin/build_docs.sh
|
|
|
|
./bin/build_pip.sh
|
2020-11-23 16:52:15 -05:00
|
|
|
./bin/build_deb.sh
|
2020-10-10 16:44:56 -04:00
|
|
|
./bin/build_docker.sh
|
2020-07-28 06:11:30 -04:00
|
|
|
|
2020-10-10 16:44:56 -04:00
|
|
|
|
|
|
|
# Push build to github
|
2020-08-18 02:14:18 -04:00
|
|
|
echo "[^] Pushing source to github"
|
2020-10-10 16:44:56 -04:00
|
|
|
git add "$REPO_DIR/docs"
|
2020-11-28 02:45:24 -05:00
|
|
|
git add "$REPO_DIR/deb_dist"
|
2020-10-10 16:44:56 -04:00
|
|
|
git add "$REPO_DIR/package.json"
|
|
|
|
git add "$REPO_DIR/package-lock.json"
|
2020-08-18 15:00:00 -04:00
|
|
|
git add "$REPO_DIR/archivebox.egg-info"
|
2020-08-18 02:14:18 -04:00
|
|
|
git commit -m "$NEW_VERSION release"
|
|
|
|
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
|
|
|
git push origin master
|
|
|
|
git push origin --tags
|
|
|
|
|
2020-10-10 16:44:56 -04:00
|
|
|
|
|
|
|
# Push releases to github
|
2020-07-28 06:11:30 -04:00
|
|
|
echo "[^] Uploading to test.pypi.org"
|
2020-11-28 03:43:59 -05:00
|
|
|
python3 -m twine upload --repository testpypi pip_dist/*.{whl,tar.gz}
|
2020-07-28 06:11:30 -04:00
|
|
|
|
|
|
|
echo "[^] Uploading to pypi.org"
|
2020-11-28 03:43:59 -05:00
|
|
|
python3 -m twine upload --repository pypi pip_dist/*.{whl,tar.gz}
|
2020-07-28 06:11:30 -04:00
|
|
|
|
2020-11-23 16:52:15 -05:00
|
|
|
echo "[^] Uploading to launchpad.net"
|
2020-11-23 17:28:45 -05:00
|
|
|
dput archivebox "deb_dist/archivebox_${NEW_VERSION}-1_source.changes"
|
2020-11-23 16:52:15 -05:00
|
|
|
|
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
|
2020-11-23 02:20:01 -05:00
|
|
|
docker push docker.io/archivebox/archivebox
|
2020-11-23 16:52:15 -05:00
|
|
|
docker push docker.pkg.github.com/archivebox/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"
|