xref: /OpenGrok/dev/javadoc.sh (revision 80a86e8631ac0e93b4c9a5a78c9395f36651c62f)
117ce305cSVladimir Kotal#!/bin/bash
217ce305cSVladimir Kotal
317ce305cSVladimir Kotalset -e
4d57bcbe0SVladimir Kotalset -x
517ce305cSVladimir Kotal
6*80a86e86SVladimir Kotalif [[ -n $OPENGROK_REF && $OPENGROK_REF == refs/heads/* ]]; then
7*80a86e86SVladimir Kotal	OPENGROK_BRANCH=${OPENGROK_REF#"refs/heads/"}
8*80a86e86SVladimir Kotalfi
9*80a86e86SVladimir Kotal
10*80a86e86SVladimir Kotalif [[ "${OPENGROK_REPO_SLUG}" != "oracle/opengrok" ||
11*80a86e86SVladimir Kotal    -n "${OPENGROK_PULL_REQUEST}" ||
12*80a86e86SVladimir Kotal    "${OPENGROK_BRANCH}" != "master" ]]; then
13efc06f38SVladimir Kotal	echo "Skipping Javadoc refresh"
14c34749e2SVladimir Kotal	exit 0
15c34749e2SVladimir Kotalfi
16c34749e2SVladimir Kotal
17b59b9fafSVladimir KotalBRANCH="gh-pages"
18b59b9fafSVladimir Kotalecho -e "Publishing javadoc to $BRANCH...\n"
19c34749e2SVladimir Kotal
2086b0ab6bSAdam Hornacek./mvnw -DskipTests=true site
2117ce305cSVladimir Kotal
2217ce305cSVladimir Kotalgit config --global user.email "travis@travis-ci.org"
2317ce305cSVladimir Kotalgit config --global user.name "travis-ci"
24b59b9fafSVladimir Kotalgit clone --quiet --branch=$BRANCH \
25b59b9fafSVladimir Kotal    https://${GH_PAGES_TOKEN}@github.com/oracle/opengrok "$BRANCH"
2617ce305cSVladimir Kotal
27b59b9fafSVladimir Kotalcd "$BRANCH"
2817ce305cSVladimir Kotalif [[ -d ./javadoc ]]; then
2917ce305cSVladimir Kotal	git rm -rf ./javadoc
3017ce305cSVladimir Kotalfi
31*80a86e86SVladimir Kotalcp -Rf ${OPENGROK_BUILD_DIR}/target/site/apidocs ./javadoc
3217ce305cSVladimir Kotalgit add -f ./javadoc
33b59b9fafSVladimir Kotalgit commit -m "Lastest javadoc auto-pushed to branch $BRANCH"
34b59b9fafSVladimir Kotalgit push -fq origin "$BRANCH"
35c34749e2SVladimir Kotal
36b59b9fafSVladimir Kotalecho -e "Published Javadoc to branch $BRANCH.\n"
37