Skip to content

Commit

Permalink
adding deploy script and configuration for Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers committed Oct 31, 2017
1 parent f4f7358 commit 30aaccf
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: generic

python:
- 3.6

install:
- pip install --user sphinx sphinx_rtd_theme

script: bash ./build_and_deploy.sh

env:
global:
- COMMIT_AUTHOR_EMAIL: "atmyers@lbl.gov"

addons:
apt:
packages:
- doxygen
62 changes: 62 additions & 0 deletions build_and_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails

SOURCE_BRANCH="development"
TARGET_BRANCH="gh-pages"

# Pull requests and commits to other branches shouldn't try to deploy
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
echo "Skipping deploy."
exit 0
fi

# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`

# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
git clone $REPO out
cd out
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
cd ..

# Clean out existing contents
rm -rf out/**/* || exit 0

# build the Doxygen documentation
cd Docs/Doxygen
doxygen doxygen.conf
cd ../..

# move it to the right place
mkdir out/doxygen
mv Docs/Doxygen/html/* out/doxygen/

# now do sphinx
cd Docs/sphinx
make html
cd ../../

mv Docs/sphinx/build/html/* out/
touch out/.nojekyll

# Now let's go have some fun with the cloned repo
cd out
git config user.name "Travis CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"

# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old versions.
git add --all
git commit -m "Deploy to GitHub Pages: ${SHA}"

openssl aes-256-cbc -K $encrypted_6602cdd8f9c9_key -iv $encrypted_6602cdd8f9c9_iv -in ../id_rsa_travis.enc -out ../id_rsa_travis -d
chmod 600 ../id_rsa_travis
eval `ssh-agent -s`
ssh-add ../id_rsa_travis

git push $SSH_REPO $TARGET_BRANCH
ssh-agent -k

Binary file added id_rsa_travis.enc
Binary file not shown.

0 comments on commit 30aaccf

Please sign in to comment.