diff options
author | Daniel Santiago <danysantiago@google.com> | 2021-01-28 13:13:52 -0800 |
---|---|---|
committer | Dagger Team <dagger-dev+copybara@google.com> | 2021-01-28 13:15:22 -0800 |
commit | 89b334dfff9d2342874049848a0b1b7f7704e0e4 (patch) | |
tree | 78ef579558602724e8db70707b93dd5a7cf12748 /util | |
parent | 0d9be9463d2283428724542d0d8f9b564031d2c2 (diff) | |
download | dagger2-89b334dfff9d2342874049848a0b1b7f7704e0e4.tar.gz |
Add publishing docs to Github Pages step into the Github Workflow
RELNOTES=N/A
PiperOrigin-RevId: 354378373
Diffstat (limited to 'util')
-rwxr-xr-x | util/generate-latest-docs.sh | 23 | ||||
-rwxr-xr-x | util/run-local-tests.sh | 4 |
2 files changed, 12 insertions, 15 deletions
diff --git a/util/generate-latest-docs.sh b/util/generate-latest-docs.sh index 873201712..54b8c0440 100755 --- a/util/generate-latest-docs.sh +++ b/util/generate-latest-docs.sh @@ -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 "travis@travis-ci.org" - git config --global user.name "travis-ci" + git config --global user.email "dagger-dev+github@google.com" + 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 diff --git a/util/run-local-tests.sh b/util/run-local-tests.sh index 911244233..2a07fc272 100755 --- a/util/run-local-tests.sh +++ b/util/run-local-tests.sh @@ -2,8 +2,8 @@ set -ex -# These jobs should match travis.yml. We can't run this script directly in -# travis since it's too slow for a single job. +# These jobs should match .github/workflows/ci.yml. We can't run this script +# directly in Github since it's too slow for a single job. # Run local bazel tests bazel test --test_output=errors //... |