forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add publishing docs to Github Pages step into the Github Workflow
RELNOTES=N/A PiperOrigin-RevId: 354378373
- Loading branch information
1 parent
0d9be94
commit 89b334d
Showing
4 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
# see http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ for details | ||
|
||
set -eux | ||
|
||
if [ "$TRAVIS_REPO_SLUG" == "google/dagger" ] && \ | ||
[ "$TRAVIS_JDK_VERSION" == "$JDK_FOR_PUBLISHING" ] && \ | ||
[ "$TRAVIS_PULL_REQUEST" == "false" ] && \ | ||
[ "$TRAVIS_BRANCH" == "master" ]; then | ||
if [ "$GITHUB_REPOSITORY" == "google/dagger" ] && \ | ||
[ "$GITHUB_EVENT_NAME" == "push" ] && \ | ||
[ "$GITHUB_REF" == "refs/heads/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 | ||
git clone --quiet --branch=gh-pages https://x-access-token:${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 config --global user.email "[email protected]" | ||
git config --global user.name "Dagger Team" | ||
git rm -rf api/latest | ||
mkdir -p api | ||
unzip "$JAVADOC_JAR" -d api/latest | ||
|
@@ -25,14 +22,14 @@ if [ "$TRAVIS_REPO_SLUG" == "google/dagger" ] && \ | |
# Check if there are any changes before committing, otherwise attempting | ||
# to commit will fail the build (https://stackoverflow.com/a/2659808). | ||
if git diff-index --quiet HEAD --; then | ||
# The exist status is 1, meaing there are changes to commit | ||
git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages" | ||
# The exist status is 1, meaning there are changes to commit | ||
git commit -m "Latest javadoc on successful Github build $GITHUB_WORKFLOW/$GITHUB_RUN_ID auto-pushed to gh-pages" | ||
git push -fq origin gh-pages > /dev/null | ||
echo -e "Published Javadoc to gh-pages.\n" | ||
else | ||
# The exist status is 0, meaing there are no changes to commit | ||
# The exist status is 0, meaning there are no changes to commit | ||
echo -e "Skipping publishing docs since no changes were detected." | ||
fi | ||
else | ||
echo -e "Not publishing docs for jdk=${TRAVIS_JDK_VERSION} and branch=${TRAVIS_BRANCH}" | ||
echo -e "Not publishing docs for branch=${$GITHUB_REF}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters