|
| 1 | +# Copyright 2023 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# A workflow that updates the gh-pages branch whenever a new release is made |
| 16 | +name: Update documentation |
| 17 | + |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [ main ] |
| 21 | + repository_dispatch: |
| 22 | + types: [gh-pages] |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +jobs: |
| 26 | + gh-page-sync: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 31 | + - name: Checkout Repo |
| 32 | + uses: actions/checkout@v2 |
| 33 | + |
| 34 | + - name: Gradle Wrapper Validation |
| 35 | + |
| 36 | + |
| 37 | + - name: Set up JDK 17 |
| 38 | + |
| 39 | + with: |
| 40 | + java-version: '17' |
| 41 | + distribution: 'temurin' |
| 42 | + |
| 43 | + # Run dokka and create tar |
| 44 | + - name: Generate documentation |
| 45 | + run: | |
| 46 | + ./gradlew dokkaHtml |
| 47 | +
|
| 48 | + echo "Creating tar for generated docs" |
| 49 | + cd $GITHUB_WORKSPACE/build/dokka/html && tar cvf ~/android-maps-utils-docs.tar . |
| 50 | +
|
| 51 | + echo "Unpacking tar into gh-pages branch" |
| 52 | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* |
| 53 | + cd $GITHUB_WORKSPACE && git checkout gh-pages && tar xvf ~/android-maps-utils-docs.tar |
| 54 | +
|
| 55 | + # Commit changes and create a PR |
| 56 | + - name: PR Changes |
| 57 | + uses: peter-evans/create-pull-request@v3 |
| 58 | + with: |
| 59 | + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} |
| 60 | + commit-message: 'docs: Update docs' |
| 61 | + author: googlemaps-bot <[email protected]> |
| 62 | + committer: googlemaps-bot <[email protected]> |
| 63 | + labels: docs |
| 64 | + title: 'docs: Update docs' |
| 65 | + body: | |
| 66 | + Updated GitHub pages with latest from `./gradlew dokkaHtml`. |
| 67 | + branch: googlemaps-bot/update_gh_pages |
0 commit comments