xref: /OpenGrok/dev/javadoc.sh (revision 538a5d117d4b92f3d83cb80d3cd4909e404db4ff)
117ce305cSVladimir Kotal#!/bin/bash
217ce305cSVladimir Kotal
317ce305cSVladimir Kotalset -e
4d57bcbe0SVladimir Kotalset -x
517ce305cSVladimir Kotal
680a86e86SVladimir Kotalif [[ -n $OPENGROK_REF && $OPENGROK_REF == refs/heads/* ]]; then
780a86e86SVladimir Kotal	OPENGROK_BRANCH=${OPENGROK_REF#"refs/heads/"}
880a86e86SVladimir Kotalfi
980a86e86SVladimir Kotal
1080a86e86SVladimir Kotalif [[ "${OPENGROK_REPO_SLUG}" != "oracle/opengrok" ||
1180a86e86SVladimir Kotal    -n "${OPENGROK_PULL_REQUEST}" ||
1280a86e86SVladimir Kotal    "${OPENGROK_BRANCH}" != "master" ]]; then
13efc06f38SVladimir Kotal	echo "Skipping Javadoc refresh"
14c34749e2SVladimir Kotal	exit 0
15c34749e2SVladimir Kotalfi
16c34749e2SVladimir Kotal
17b59b9fafSVladimir KotalBRANCH="gh-pages"
18c34749e2SVladimir Kotal
19*538a5d11SVladimir Kotalecho -e "Building Javadoc...\n"
2086b0ab6bSAdam Hornacek./mvnw -DskipTests=true site
2117ce305cSVladimir Kotal
22*538a5d11SVladimir Kotalecho -e "Publishing javadoc to $BRANCH...\n"
23d06d067eSVladimir Kotalgit config --global user.email "noreply@github.com"
24d06d067eSVladimir Kotalgit config --global user.name "Foo Bar"
25b59b9fafSVladimir Kotalgit clone --quiet --branch=$BRANCH \
26*538a5d11SVladimir Kotal    https://github.com/oracle/opengrok "$BRANCH"
2717ce305cSVladimir Kotal
28b59b9fafSVladimir Kotalcd "$BRANCH"
2917ce305cSVladimir Kotalif [[ -d ./javadoc ]]; then
3017ce305cSVladimir Kotal	git rm -rf ./javadoc
3117ce305cSVladimir Kotalfi
3280a86e86SVladimir Kotalcp -Rf ${OPENGROK_BUILD_DIR}/target/site/apidocs ./javadoc
3317ce305cSVladimir Kotalgit add -f ./javadoc
34b59b9fafSVladimir Kotalgit commit -m "Lastest javadoc auto-pushed to branch $BRANCH"
35b59b9fafSVladimir Kotalgit push -fq origin "$BRANCH"
36c34749e2SVladimir Kotal
37b59b9fafSVladimir Kotalecho -e "Published Javadoc to branch $BRANCH.\n"
38