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