11#! /usr/bin/env bash
22
3- # Prepare/organized Doxygen generated HTML documentation to Github for hosting by `deploy_docs.sh` .
3+ # Prepare/organize Doxygen generated HTML documentation to be hosted on Github .
44#
5- # This script organizes the Doxygen generated HTML documentation and commits it to local .git repository.
6- # Doxygen generated HTML documentation to the MAST Github repository for hosting. This script should be called
7- # during the Travis-CI 'script' phase after documentation is built so that if an error occurs we can catch it
8- # on a non-master build (the 'deploy' stage only runs for commits on the `master` branch). We currently call it
9- # inside of `ci/build_mast.sh` on the worker that satisfies ${CI_BUILD_DOCS}=true.
5+ # This script organizes the Doxygen generated HTML documentation and commits it to a local .git repository.
6+ # This script should be called during the Travis-CI 'script' phase after documentation is built so that
7+ # if an error occurs we can catch it on a non-master build (the 'deploy' stage only runs for commits on the
8+ # `master` branch). We currently call it inside of `ci/build_mast.sh` on the worker that satisfies
9+ # the condition ${CI_BUILD_DOCS}=true. To actually deploy the documentation (after running this script)
10+ # call `ci/deploy_docs.sh`.
1011#
1112# Contents of this script (and `deploy_docs.sh`) were inspired in part by
1213# https://gist.github.com/willprice/e07efd73fb7f13f917ea.
1516git config --global user.email
" [email protected] " || exit 1617git config --global user.name " Travis CI" || exit
1718
18- # Organize website content. First delete all current contents (except .git directory) and then copy generated
19- # HTML and other desired files.
19+ # Organize website content. First make sure we delete any existing website contents (these may exist from
20+ # a previous Travis-CI cache) and then copy generated HTML and other desired files.
21+ rm -rf ${TRAVIS_BUILD_DIR} /website # Don't `|| exit` here. Its not a failure if this directory doesn't exist when
22+ # we try to delete it.
2023mkdir ${TRAVIS_BUILD_DIR} /website || exit
2124cd ${TRAVIS_BUILD_DIR} /website || exit
2225rsync -r ${TRAVIS_BUILD_DIR} /build_rel/doc/doxygen/html/ . || exit
2326
2427# Initialize empty git repository. Add all files. Commit.
2528git init || exit
2629git add . || exit
27- git commit --quiet --message " Travis build ${TRAVIS_BUILD_NUMBER} , mast-multiphysics commit ${TRAVIS_COMMIT} " || exit
30+ git commit --quiet --message " Travis build ${TRAVIS_BUILD_NUMBER} , mast-multiphysics commit ${TRAVIS_COMMIT} " || exit
31+
32+ # Add remote where we will push website to on actual deployment. GH_TOKEN environment variable is set automatically
33+ # in the Travis-CI, but must from an account that can push to https://github.com/MASTmultiphysics/MASTmultiphysics.github.io
34+ git remote add origin https://${GH_TOKEN} @github.com/MASTmultiphysics/MASTmultiphysics.github.io.git || exit
0 commit comments