2011-06-04 00:55:06 +04:00
|
|
|
#!/bin/zsh
|
|
|
|
|
2013-05-15 15:51:52 +04:00
|
|
|
# A useful build script for projects hosted on github:
|
|
|
|
# It can build your Sphinx docs and push them straight to your gh-pages branch.
|
|
|
|
|
2011-06-04 00:55:06 +04:00
|
|
|
# Should be run from the docs directory: (cd docs && ./build-github.zsh)
|
|
|
|
|
|
|
|
REPO=$(git config remote.origin.url)
|
2011-06-04 01:26:41 +04:00
|
|
|
HERE=$(dirname $0)
|
|
|
|
GH=$HERE/_gh-pages
|
2011-06-04 00:55:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
# Checkout the gh-pages branch, if necessary.
|
|
|
|
if [[ ! -d $GH ]]; then
|
|
|
|
git clone $REPO $GH
|
|
|
|
pushd $GH
|
|
|
|
git checkout -b gh-pages origin/gh-pages
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update and clean out the _gh-pages target dir.
|
2011-06-04 01:26:41 +04:00
|
|
|
pushd $GH
|
|
|
|
git pull && rm -rf *
|
|
|
|
popd
|
2011-06-04 00:55:06 +04:00
|
|
|
|
|
|
|
# Make a clean build.
|
2011-06-04 01:26:41 +04:00
|
|
|
pushd $HERE
|
2011-06-04 00:55:06 +04:00
|
|
|
make clean dirhtml
|
|
|
|
|
|
|
|
# Move the fresh build over.
|
|
|
|
cp -r _build/dirhtml/* $GH
|
2011-06-04 01:26:41 +04:00
|
|
|
pushd $GH
|
2011-06-04 00:55:06 +04:00
|
|
|
|
|
|
|
# Commit.
|
|
|
|
git add .
|
|
|
|
git commit -am "gh-pages build on $(date)"
|
|
|
|
git push origin gh-pages
|
2011-06-04 01:26:41 +04:00
|
|
|
|
|
|
|
popd
|
|
|
|
popd
|