mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-22 12:13:05 +00:00
update helper scripts
This commit is contained in:
parent
f773b84a7c
commit
a14146c8f0
5 changed files with 103 additions and 57 deletions
26
bin/build.sh
26
bin/build.sh
|
@ -12,31 +12,11 @@ IFS=$'\n'
|
|||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
|
||||
source "$REPO_DIR/.venv/bin/activate"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# echo "[*] Fetching latest docs version"
|
||||
# cd "$REPO_DIR/docs"
|
||||
# git pull
|
||||
# cd "$REPO_DIR"
|
||||
|
||||
# echo "[+] Building docs"
|
||||
# sphinx-apidoc -o docs archivebox
|
||||
# cd "$REPO_DIR/docs"
|
||||
# make html
|
||||
# cd "$REPO_DIR"
|
||||
|
||||
echo "[*] Cleaning up build dirs"
|
||||
cd "$REPO_DIR"
|
||||
rm -Rf build dist archivebox.egg-info
|
||||
|
||||
echo "[+] Building sdist, bdist_egg, and bdist_wheel"
|
||||
python3 setup.py sdist bdist_egg bdist_wheel
|
||||
|
||||
echo "[+] Building docker image in the background..."
|
||||
docker build . -t archivebox \
|
||||
-t archivebox:latest > /tmp/archivebox_docker_build.log 2>&1 &
|
||||
ps "$!"
|
||||
./bin/build_docs.sh
|
||||
./bin/build_pip.sh
|
||||
./bin/build_docker.sh
|
||||
|
||||
echo "[√] Done. Install the built package by running:"
|
||||
echo " python3 setup.py install"
|
||||
|
|
25
bin/build_docker.sh
Normal file
25
bin/build_docker.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/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'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
|
||||
echo "[+] Building docker image in the background..."
|
||||
docker build . -t archivebox \
|
||||
-t archivebox:latest \
|
||||
-t archivebox:$VERSION \
|
||||
-t docker.io/nikisweeting/archivebox:latest \
|
||||
-t docker.io/nikisweeting/archivebox:$VERSION \
|
||||
-t docker.pkg.github.com/pirate/archivebox/archivebox:latest \
|
||||
-t docker.pkg.github.com/pirate/archivebox/archivebox:$VERSION
|
30
bin/build_docs.sh
Normal file
30
bin/build_docs.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/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'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
|
||||
source "$REPO_DIR/.venv/bin/activate"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
|
||||
|
||||
echo "[*] Fetching latest docs version"
|
||||
cd "$REPO_DIR/docs"
|
||||
git pull
|
||||
cd "$REPO_DIR"
|
||||
|
||||
echo "[+] Building docs"
|
||||
sphinx-apidoc -o docs archivebox
|
||||
cd "$REPO_DIR/docs"
|
||||
make html
|
||||
# open docs/_build/html/index.html to see the output
|
||||
cd "$REPO_DIR"
|
24
bin/build_pip.sh
Normal file
24
bin/build_pip.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/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'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
|
||||
source "$REPO_DIR/.venv/bin/activate"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
|
||||
echo "[*] Cleaning up build dirs"
|
||||
cd "$REPO_DIR"
|
||||
rm -Rf build dist archivebox.egg-info
|
||||
|
||||
echo "[+] Building sdist, bdist_egg, and bdist_wheel"
|
||||
python3 setup.py sdist bdist_egg bdist_wheel
|
|
@ -12,27 +12,12 @@ IFS=$'\n'
|
|||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
|
||||
function bump_semver {
|
||||
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
||||
}
|
||||
|
||||
source "$REPO_DIR/.venv/bin/activate"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
OLD_VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
||||
|
||||
echo "[*] Fetching latest docs version"
|
||||
cd "$REPO_DIR/docs"
|
||||
git pull
|
||||
cd "$REPO_DIR"
|
||||
|
||||
echo "[+] Building docs"
|
||||
sphinx-apidoc -o docs archivebox
|
||||
cd "$REPO_DIR/docs"
|
||||
make html
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# Make sure git is clean
|
||||
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
||||
git pull
|
||||
else
|
||||
|
@ -41,42 +26,44 @@ else
|
|||
sleep 10
|
||||
fi
|
||||
|
||||
|
||||
# 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")"
|
||||
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
||||
contents="$(jq ".version = \"$NEW_VERSION\"" "$REPO_DIR/package.json")" && \
|
||||
echo "${contents}" > package.json
|
||||
|
||||
|
||||
# Build docs, python package, and docker image
|
||||
./bin/build_docs.sh
|
||||
./bin/build_pip.sh
|
||||
./bin/build_docker.sh
|
||||
|
||||
|
||||
# Push build to github
|
||||
echo "[^] Pushing source to github"
|
||||
git add "$REPO_DIR/docs"
|
||||
git add "$REPO_DIR/package.json"
|
||||
git add "$REPO_DIR/package-lock.json"
|
||||
|
||||
echo "[*] Cleaning up build dirs"
|
||||
cd "$REPO_DIR"
|
||||
rm -Rf build dist archivebox.egg-info
|
||||
|
||||
echo "[+] Building sdist and bdist_wheel"
|
||||
python3 setup.py sdist bdist_egg bdist_wheel
|
||||
|
||||
echo "[^] Pushing source to github"
|
||||
git add "$REPO_DIR/archivebox.egg-info"
|
||||
git commit -m "$NEW_VERSION release"
|
||||
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
||||
git push origin master
|
||||
git push origin --tags
|
||||
|
||||
|
||||
# Push releases to github
|
||||
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/*
|
||||
|
||||
echo "[+] Building docker image"
|
||||
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
|
||||
|
||||
echo "[^] Uploading docker image"
|
||||
# docker login --username=nikisweeting
|
||||
# docker login docker.pkg.github.com --username=pirate
|
||||
|
|
Loading…
Reference in a new issue