xref: /OpenGrok/dev/javadoc.sh (revision b59b9faf99ed77c04e6e25e03eb1746c2337dc27)
117ce305cSVladimir Kotal#!/bin/bash
217ce305cSVladimir Kotal
317ce305cSVladimir Kotalset -e
4d57bcbe0SVladimir Kotalset -x
517ce305cSVladimir Kotal
6c34749e2SVladimir Kotalif [[ "${TRAVIS_REPO_SLUG}" != "oracle/opengrok" ||
75a7a4160SVladimir Kotal    "${TRAVIS_PULL_REQUEST}" != "false" ||
8c34749e2SVladimir Kotal    "${TRAVIS_BRANCH}" != "master" ]]; then
9efc06f38SVladimir Kotal	echo "Skipping Javadoc refresh"
10c34749e2SVladimir Kotal	exit 0
11c34749e2SVladimir Kotalfi
12c34749e2SVladimir Kotal
13*b59b9fafSVladimir KotalBRANCH="gh-pages"
14*b59b9fafSVladimir Kotalecho -e "Publishing javadoc to $BRANCH...\n"
15c34749e2SVladimir Kotal
1686b0ab6bSAdam Hornacek./mvnw -DskipTests=true site
1717ce305cSVladimir Kotal
1817ce305cSVladimir Kotalgit config --global user.email "travis@travis-ci.org"
1917ce305cSVladimir Kotalgit config --global user.name "travis-ci"
20*b59b9fafSVladimir Kotalgit clone --quiet --branch=$BRANCH \
21*b59b9fafSVladimir Kotal    https://${GH_PAGES_TOKEN}@github.com/oracle/opengrok "$BRANCH"
2217ce305cSVladimir Kotal
23*b59b9fafSVladimir Kotalcd "$BRANCH"
2417ce305cSVladimir Kotalif [[ -d ./javadoc ]]; then
2517ce305cSVladimir Kotal	git rm -rf ./javadoc
2617ce305cSVladimir Kotalfi
2717ce305cSVladimir Kotalcp -Rf ${TRAVIS_BUILD_DIR}/target/site/apidocs ./javadoc
2817ce305cSVladimir Kotalgit add -f ./javadoc
29*b59b9fafSVladimir Kotalgit commit -m "Lastest javadoc auto-pushed to branch $BRANCH"
30*b59b9fafSVladimir Kotalgit push -fq origin "$BRANCH"
31c34749e2SVladimir Kotal
32*b59b9fafSVladimir Kotalecho -e "Published Javadoc to branch $BRANCH.\n"
33