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 19538a5d11SVladimir Kotalecho -e "Building Javadoc...\n" 2086b0ab6bSAdam Hornacek./mvnw -DskipTests=true site 2117ce305cSVladimir Kotal 22538a5d11SVladimir Kotalecho -e "Publishing javadoc to $BRANCH...\n" 23*16762577SVladimir Kotalgit config --global user.name "github-actions[bot]" 24*16762577SVladimir Kotalgit config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 25b59b9fafSVladimir Kotalgit clone --quiet --branch=$BRANCH \ 26538a5d11SVladimir 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