Spaces:
Running
Running
| function deploy_doc(){ | |
| if [ ! -z "$1" ] | |
| then | |
| git checkout $1 | |
| fi | |
| COMMIT=$(git rev-parse --short HEAD) | |
| echo "Creating doc at commit" $COMMIT "and pushing to folder $2" | |
| pip install -U .. | |
| if [ ! -z "$2" ] | |
| then | |
| if [ "$2" == "latest" ]; then | |
| echo "Pushing main" | |
| sphinx-build source _build -a && mkdir build && mkdir build/$2 && cp -a _build/* build/$2/ | |
| elif [ -d build/$2 ]; then | |
| echo "Directory" $2 "already exists" | |
| else | |
| echo "Pushing version" $2 | |
| cp -r _static source/ && cp _conf.py source/conf.py | |
| sphinx-build source _build -a | |
| mkdir build/$2 && cp -a _build/* build/$2/ && git checkout source/ && git clean -f source/ | |
| fi | |
| else | |
| echo "Pushing stable" | |
| cp -r _static source/ && cp _conf.py source/conf.py | |
| sphinx-build source build -a && git checkout source/ && git clean -f source/ | |
| fi | |
| } | |
| # You can find the commit for each tag on https://github.com/mindee/doctr/tags | |
| if [ -d build ]; then rm -Rf build; fi | |
| cp -r source/_static . | |
| cp source/conf.py _conf.py | |
| git fetch --all --tags --unshallow | |
| deploy_doc "" latest | |
| deploy_doc "1c9ce92" v0.11.0 | |
| deploy_doc "97d4006" v0.12.0 | |
| deploy_doc "7dabbe1" # v1.0.0 Latest stable release | |
| rm -rf _build _static _conf.py | |