xref: /OpenGrok/dev/javadoc.sh (revision c34749e20ac616c88ed7db04475402b5f823ee17)
117ce305cSVladimir Kotal#!/bin/bash
217ce305cSVladimir Kotal
317ce305cSVladimir Kotalset -e
417ce305cSVladimir Kotal
5*c34749e2SVladimir Kotalif [[ "${TRAVIS_REPO_SLUG}" != "oracle/opengrok" ||
6*c34749e2SVladimir Kotal    "${TRAVIS_PULL_REQUEST}" == "true" ||
7*c34749e2SVladimir Kotal    "${TRAVIS_BRANCH}" != "master" ]]; then
8*c34749e2SVladimir Kotal	exit 0
9*c34749e2SVladimir Kotalfi
10*c34749e2SVladimir Kotal
11*c34749e2SVladimir Kotalecho -e "Publishing javadoc...\n"
12*c34749e2SVladimir Kotal
1317ce305cSVladimir Kotalmvn -DskipTests=true site
1417ce305cSVladimir Kotal
1517ce305cSVladimir Kotalgit config --global user.email "travis@travis-ci.org"
1617ce305cSVladimir Kotalgit config --global user.name "travis-ci"
1717ce305cSVladimir Kotalgit clone --quiet --branch=gh-pages \
1817ce305cSVladimir Kotal    https://${GH_PAGES_TOKEN}@github.com/opengrok/opengrok gh-pages
1917ce305cSVladimir Kotal
2017ce305cSVladimir Kotalcd gh-pages
2117ce305cSVladimir Kotalif [[ -d ./javadoc ]]; then
2217ce305cSVladimir Kotal	git rm -rf ./javadoc
2317ce305cSVladimir Kotalfi
2417ce305cSVladimir Kotalcp -Rf ${TRAVIS_BUILD_DIR}/target/site/apidocs ./javadoc
2517ce305cSVladimir Kotalgit add -f ./javadoc
2617ce305cSVladimir Kotalgit commit -m "Lastest javadoc auto-pushed to gh-pages"
2717ce305cSVladimir Kotalgit push -fq origin gh-pages
28*c34749e2SVladimir Kotal
29*c34749e2SVladimir Kotalecho -e "Published Javadoc to gh-pages.\n"
30