1# see http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ for details 2 3if [ "$TRAVIS_REPO_SLUG" == "google/guice" ] && \ 4 [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && \ 5 [ "$LABEL" == "ant" ] && \ 6 [ "$TRAVIS_PULL_REQUEST" == "false" ] && \ 7 [ "$TRAVIS_BRANCH" == "master" ]; then 8 echo -e "Publishing javadoc & JDiff...\n" 9 rm -rf build/docs 10 ant javadoc jdiff 11 cp -R build/docs/javadoc $HOME/javadoc-latest 12 cp -R build/docs/latest-api-diffs $HOME/api-diffs-latest 13 cp lib/build/jdiff/*.gif $HOME/api-diffs-latest/ 14 15 cd $HOME 16 git config --global user.email "travis@travis-ci.org" 17 git config --global user.name "travis-ci" 18 git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/google/guice gh-pages > /dev/null 19 20 cd gh-pages 21 git rm -rf api-docs/latest/api-diffs api-docs/latest/javadoc 22 mkdir -p api-docs/latest 23 cp -rf $HOME/api-diffs-latest api-docs/latest/api-diffs 24 cp -rf $HOME/javadoc-latest api-docs/latest/javadoc 25 git add -f . 26 git commit -m "Lastest javadoc & api-diffs on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages" 27 git push -fq origin gh-pages > /dev/null 28 29 echo -e "Published Javadoc & JDiff to gh-pages.\n" 30fi 31