forked from google/dagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-latest-docs.sh
executable file
·30 lines (25 loc) · 1.06 KB
/
generate-latest-docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# see http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ for details
set -eu
if [ "$TRAVIS_REPO_SLUG" == "google/dagger" ] && \
[ "$TRAVIS_JDK_VERSION" == "$JDK_FOR_PUBLISHING" ] && \
[ "$TRAVIS_PULL_REQUEST" == "false" ] && \
[ "$TRAVIS_BRANCH" == "master" ]; then
echo -e "Publishing javadoc...\n"
bazel build //:user-docs.jar
JAVADOC_JAR="$(pwd)/bazel-bin/user-docs.jar"
cd $HOME
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/google/dagger gh-pages > /dev/null
cd gh-pages
git config --global user.email "[email protected]"
git config --global user.name "travis-ci"
git rm -rf api/latest
mkdir -p api
unzip "$JAVADOC_JAR" -d api/latest
rm -rf api/latest/META-INF/
git add -f api/latest
git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
git push -fq origin gh-pages > /dev/null
echo -e "Published Javadoc to gh-pages.\n"
else
echo -e "Not publishing docs for jdk=${TRAVIS_JDK_VERSION} and branch=${TRAVIS_BRANCH}"
fi