Skip to content

Commit e33b692

Browse files
authored
Merge pull request #56 from MASTmultiphysics/hotfix/ci-doc-deploy
Fix documentation deployment error due to Travis-CI cache. Closes #56
2 parents f99b98a + cdfe27c commit e33b692

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

ci/deploy_docs.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
# Deploy organized HTML documentation to Github for hosting.
44
#
55
# This script deploys organized HTML documentation produced by `prepare_docs.sh` to a repository in the MAST Team
6-
# GitHub repository for hosting. It is meant to be called during the Travis-CI `deploy` stage and requires the
7-
# GH_TOKEN environment variable be set in the Travis-CI job from an account that can push
8-
# to https://github.com/MASTmultiphysics/MASTmultiphysics.github.io
6+
# GitHub repository for hosting using a simple git push. It is meant to be called during the Travis-CI
7+
# `deploy` stage and requires the GH_TOKEN environment variable be set in the Travis-CI job from
8+
# an account that can push to https://github.com/MASTmultiphysics/MASTmultiphysics.github.io. The GH_TOKEN variable
9+
# is specified in the Travis-CI web interface as a secret variable so it is not displayed publically.
910
#
1011
# Contents of this script (and `prepare_docs.sh`) were inspired in part
1112
# by https://gist.github.com/willprice/e07efd73fb7f13f917ea.
1213

1314
# Set git remote URL. Force push to GitHub website repository.
1415
# Update git remote URL to include ${GH_TOKEN} key. Push files back to GitHub website repository.
15-
git remote add origin https://${GH_TOKEN}@github.com/MASTmultiphysics/MASTmultiphysics.github.io.git || exit
16+
cd ${TRAVIS_BUILD_DIR}/website || exit
1617
git push --force origin master || exit
1718

ci/prepare_docs.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
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.
@@ -15,13 +16,19 @@
1516
git config --global user.email "[email protected]" || exit
1617
git 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.
2023
mkdir ${TRAVIS_BUILD_DIR}/website || exit
2124
cd ${TRAVIS_BUILD_DIR}/website || exit
2225
rsync -r ${TRAVIS_BUILD_DIR}/build_rel/doc/doxygen/html/ . || exit
2326

2427
# Initialize empty git repository. Add all files. Commit.
2528
git init || exit
2629
git 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

Comments
 (0)