Skip to content

Instantly share code, notes, and snippets.

@lukespragg
Created September 27, 2014 23:45
Show Gist options
  • Save lukespragg/ff7fd9492aeb0c57e7d4 to your computer and use it in GitHub Desktop.
Save lukespragg/ff7fd9492aeb0c57e7d4 to your computer and use it in GitHub Desktop.
Basic script for updating GitHub pages from Travis-CI.
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Changing directory to $HOME and configuring git"
cd $HOME
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis"
echo -e "Cloning gh-pages repo using token"
git clone --quiet --branch=gh-pages https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages > /dev/null
echo -e "Copy apidocs to gh-pages repo root"
cd gh-pages
cp -Rf $HOME/build/$TRAVIS_REPO_SLUG/target/site/apidocs/* .
echo -e "Adding, committing, and pushing apidocs to gh-pages repo"
git add -f .
git commit -m "Update JavaDocs for Travis build $TRAVIS_BUILD_NUMBER"
git push -q origin gh-pages > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment