| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
# Run this to build the HTML documentation using Sphinx, then commit |
| 4 |
# and push it to the docs repo. |
| 5 |
|
| 6 |
set -o errexit |
| 7 |
|
| 8 |
DOCS_REPO_OWNER=cclib |
| 9 |
DOCS_REPO_NAME=cclib.github.io |
| 10 |
DOCS_BRANCH_NAME=gh-pages |
| 11 |
GH_REPO_REF=github.com:$DOCS_REPO_OWNER/$DOCS_REPO_NAME.git |
| 12 |
|
| 13 |
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 14 |
|
| 15 |
pushd "${SCRIPTDIR}"/../doc |
| 16 |
|
| 17 |
# Make sure a copy of the custom theme is present and up-to-date. |
| 18 |
mkdir -p sphinx/_themes |
| 19 |
if [ ! -d sphinx/_themes/sphinx_rtd_theme ]; then |
| 20 |
pushd sphinx/_themes/ |
| 21 |
git clone -b cclib https://github.com/cclib/sphinx_rtd_theme.git |
| 22 |
else |
| 23 |
pushd sphinx/_themes/sphinx_rtd_theme |
| 24 |
git pull |
| 25 |
fi |
| 26 |
popd |
| 27 |
|
| 28 |
# Build the HTML documentation. |
| 29 |
make |
| 30 |
|
| 31 |
if [ ! -d $DOCS_REPO_NAME ]; then |
| 32 |
echo "Cloning $DOCS_BRANCH_NAME branch of $GH_REPO_REF..." |
| 33 |
git clone -b $DOCS_BRANCH_NAME git@$GH_REPO_REF |
| 34 |
fi |
| 35 |
cd $DOCS_REPO_NAME |
| 36 |
rm -rf ./* ./.* |
| 37 |
echo "" > .nojekyll |
| 38 |
echo "Copying built HTML..." |
| 39 |
cp -a ../sphinx/_build/html/* . |
| 40 |
|
| 41 |
echo "Adding changes..." |
| 42 |
git add --all |
| 43 |
echo "Committing..." |
| 44 |
# This will return 1 if there are no changes, which should not result |
| 45 |
# in failure. |
| 46 |
git commit -m "Deploy documentation `date`" || ret=$? |
| 47 |
git push origin $DOCS_BRANCH_NAME |
| 48 |
|
| 49 |
popd |