| 1 |
#!/bin/bash |
| 2 |
set -e # exit with nonzero exit code if anything fails |
| 3 |
export GH_PAGES_DIR="$HOME/gh-pages" |
| 4 |
|
| 5 |
# Decrypt and activate the deploy key |
| 6 |
echo Setting up access... |
| 7 |
openssl aes-256-cbc -K $encrypted_2f711532c6dd_key -iv $encrypted_2f711532c6dd_iv -in ${TRAVIS_BUILD_DIR}/ci/deploy_key.enc -out ${TRAVIS_BUILD_DIR}/ci/deploy_key -d |
| 8 |
chmod 600 ${TRAVIS_BUILD_DIR}/ci/deploy_key |
| 9 |
eval `ssh-agent -s` |
| 10 |
ssh-add ${TRAVIS_BUILD_DIR}/ci/deploy_key |
| 11 |
|
| 12 |
# Clone *this* git repo, but only the gh-pages branch. |
| 13 |
echo Cloning gh-pages... |
| 14 |
if [[ ! -d $GH_PAGES_DIR ]]; then |
| 15 |
git clone -q -b gh-pages --single-branch [email protected]:${TRAVIS_REPO_SLUG}.git $GH_PAGES_DIR |
| 16 |
fi |
| 17 |
cd $GH_PAGES_DIR |
| 18 |
|
| 19 |
# inside this git repo we'll pretend to be a new user |
| 20 |
git config user.name "Travis CI" |
| 21 |
git config user.email "[email protected]" |
| 22 |
|
| 23 |
# The first and only commit to this new Git repo contains all the |
| 24 |
# files present with the commit message "Deploy to GitHub Pages". |
| 25 |
echo Updating docs... |
| 26 |
rm -rf * |
| 27 |
cp -R ${TRAVIS_BUILD_DIR}/docs/_build/html/* ./ |
| 28 |
touch .nojekyll |
| 29 |
|
| 30 |
echo Staging... |
| 31 |
git add -A . |
| 32 |
git commit --amend --reset-author --no-edit |
| 33 |
|
| 34 |
# Push up to gh-pages |
| 35 |
echo Pushing... |
| 36 |
git push --force origin gh-pages |