• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/auto" ] && \
4   [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && \
5   [ "$TRAVIS_PULL_REQUEST" == "false" ] && \
6   [ "$TRAVIS_BRANCH" == "master" ]; then
7  echo -e "Publishing javadoc...\n"
8
9  mvn -f build-pom.xml javadoc:aggregate
10  TARGET="$(pwd)/target"
11
12  cd $HOME
13  git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/google/auto gh-pages > /dev/null
14
15  cd gh-pages
16  git config --global user.email "travis@travis-ci.org"
17  git config --global user.name "travis-ci"
18  git rm -rf api/latest
19  mv ${TARGET}/site/apidocs api/latest
20  git add -A -f api/latest
21  git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
22  git push -fq origin gh-pages > /dev/null
23
24  echo -e "Published Javadoc to gh-pages.\n"
25fi
26