Repository navigation
83 lines (71 loc) · 2.97 KB
/
Copy pathdocs.yml
File metadata and controls
83 lines (71 loc) · 2.97 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A workflow that updates the gh-pages branch whenever a new release is made
name: Update documentation
on:
release:
types: [published]
repository_dispatch:
types: [gh-pages]
workflow_dispatch:
permissions:
contents: read
jobs:
gh-page-sync:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up JDK 21
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
# Run dokka and create tar
- name: Generate documentation
run: |
./gradlew docs:dokkaGenerate
echo "Creating tar for generated docs"
cd $GITHUB_WORKSPACE/docs/build/dokka/html && tar cvf ~/maps-compose-docs.tar .
echo "Unpacking tar into gh-pages branch"
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
cd $GITHUB_WORKSPACE && git checkout gh-pages && tar xvf ~/maps-compose-docs.tar
# Commit changes and create a PR
- name: PR Changes
id: cpr
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
commit-message: 'docs: Update docs'
author: googlemaps-bot <googlemaps-bot@google.com>
committer: googlemaps-bot <googlemaps-bot@google.com>
labels: |
docs
automerge
title: 'docs: Update docs'
body: |
Updated GitHub pages with latest from `./gradlew dokkaHtml`.
branch: googlemaps-bot/update_gh_pages
# The docs PR targets gh-pages, where pull_request workflows from main never run, so merge it
# here instead of relying on a separate automerge workflow. This needs gh-pages to not require
# an approving review, since the bot cannot approve its own PR.
- name: Merge docs PR
if: steps.cpr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
run: gh pr merge "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --squash --delete-branch