Skip to content

Commit

Permalink
Fix issue with Dagger release workflow publishing tagged docs.
Browse files Browse the repository at this point in the history
This CL sets up the publish-tagged-docs script to use the access token, GH_TOKEN, if one exists, to avoid having to setup ssh and manually authenticate.

RELNOTES=N/A
PiperOrigin-RevId: 412144152
  • Loading branch information
bcorso authored and Dagger Team committed Nov 24, 2021
1 parent f39e7a6 commit 8ad8ed1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ jobs:
- name: 'Publish tagged docs'
run: util/publish-tagged-docs.sh ${{ env.DAGGER_RELEASE_VERSION }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
- name: 'Clean bazel cache'
# According to the documentation, we should be able to exclude these via
# the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
Expand Down
12 changes: 10 additions & 2 deletions util/publish-tagged-docs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# TODO(bcorso): Consider sharing this script with utils/generate-latest-docs.sh

set -eux

Expand All @@ -21,8 +22,15 @@ fi

# Publish javadocs to gh-pages
bazel build //:user-docs.jar
git clone --quiet --branch gh-pages \
https://github.com/google/dagger gh-pages > /dev/null

# If a token exists, then use the token to clone the repo. This allows our
# automated workflows to commit without manually authenticating.
if [[ ! -z "$GH_TOKEN" ]]; then
git clone --quiet --branch=gh-pages https://x-access-token:${GH_TOKEN}@github.com/google/dagger gh-pages > /dev/null
else
git clone --quiet --branch=gh-pages https://github.com/google/dagger gh-pages > /dev/null
fi

cd gh-pages
unzip ../bazel-bin/user-docs.jar -d api/$VERSION_NAME
rm -rf api/$VERSION_NAME/META-INF/
Expand Down

0 comments on commit 8ad8ed1

Please sign in to comment.