1#!/bin/bash 2 3# Run by GitHub Actions (see .github/workflows/ci.yml) 4 5set -e 6 7echo -e "Publishing javadoc...\n" 8 9mvn -f build-pom.xml javadoc:aggregate 10TARGET="$(pwd)/target" 11 12cd $HOME 13git clone --quiet --branch=gh-pages "https://x-access-token:${GITHUB_TOKEN}@github.com/google/auto" gh-pages > /dev/null 14 15cd gh-pages 16git config --global user.name "$GITHUB_ACTOR" 17git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" 18git rm -rf api/latest 19mkdir -p api # Just to make mv work if the directory is missing 20mv ${TARGET}/site/apidocs api/latest 21git add -A -f api/latest 22git commit -m "Latest javadoc on successful CI build auto-pushed to gh-pages" 23git push -fq origin gh-pages > /dev/null 24 25echo -e "Published Javadoc to gh-pages.\n" 26