-
-
Save l50/ba86e287d30a902f1ba715e2889fb78c to your computer and use it in GitHub Desktop.
github pages sphinx building script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Error: Please provide a branch name and repo name from which documentation will be built"; | |
exit 1 | |
fi | |
BRANCH_NAME=$1 | |
REPO_NAME=$2 | |
echo "Building documentation from $BRANCH_NAME" | |
echo "checking out gh-pages" | |
if ! git checkout gh-pages | |
then | |
echo >&2 "checkout of gh-pages branch failed; please ensure you have local changes commited prior to running this script " | |
echo "exiting" | |
exit 1 | |
fi | |
pwd | |
echo "removing current files" | |
rm -rf *.egg-info | |
git pull origin gh-pages | |
rm -r *.html *.js | |
touch .nojekyll | |
git checkout $BRANCH_NAME docs $REPO_NAME README.md | |
# need to do this step because the readme will be overwritten | |
pandoc -i README.md -o docs/source/README.rst | |
mv docs/* . | |
make html | |
mv -fv build/html/* ./ | |
rm -r $REPO_NAME docs build Makefile source README.* __pycache__/ | |
echo "--------------------------------------------------------------------" | |
echo " docs built; please review these changes and then run the following:" | |
echo "--------------------------------------------------------------------" | |
echo git add -A | |
echo git commit -m \"Generated gh-pages for `git log master -1 --pretty=short --abbrev-commit | grep commit`\" | |
echo git push origin gh-pages | |
echo git checkout $BRANCH_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment