Skip to content

Commit 2c30f3a

Browse files
arriolacwangela
andauthored
docs: Adding docs.yml workflow to update docs on a new tag. (#360)
* docs: Adding docs.yml workflow to update docs on a new tag. Once the docs have been generated, a new PR will be opened against the `gh-pages` branch. Resolves #348 Co-authored-by: Angela Yu <5506675+wangela@users.noreply.github.com>
1 parent ca042f5 commit 2c30f3a

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 pushes artifacts to Sonatype
16+
name: Publish
17+
18+
on:
19+
push:
20+
tags:
21+
- '*'
22+
repository_dispatch:
23+
types: [docs]
24+
25+
jobs:
26+
docs:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
33+
- name: Setup Python
34+
uses: "actions/setup-python@v3"
35+
with:
36+
python-version: "3.9"
37+
38+
- name: Install dependencies
39+
run: ./.github/scripts/install.sh
40+
41+
- name: Generate docs
42+
run: python3 -m nox --session docs
43+
44+
- name: Update gh-pages branch with docs
45+
run: |
46+
echo "Creating tar for generated docs"
47+
cd ./docs/_build/html && tar cvf ~/docs.tar .
48+
49+
echo "Unpacking tar into gh-pages branch"
50+
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
51+
cd $GITHUB_WORKSPACE && git checkout gh-pages && tar xvf ~/docs.tar
52+
53+
- name: PR Changes
54+
uses: peter-evans/create-pull-request@v4
55+
with:
56+
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
57+
commit-message: 'docs: Update docs'
58+
committer: googlemaps-bot <googlemaps-bot@google.com>
59+
author: googlemaps-bot <googlemaps-bot@google.com>
60+
title: 'docs: Update docs'
61+
body: |
62+
Updated GitHub pages with latest from `python3 -m nox --session docs`.
63+
branch: googlemaps-bot/update_gh_pages

0 commit comments

Comments
 (0)