-
Notifications
You must be signed in to change notification settings - Fork 11
106 lines (96 loc) · 3.24 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
106 lines (96 loc) · 3.24 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Documentation Page Deployment
# FUTURE
# This will eventually need to be turned into a call'able workflow_call version where we
# call this for each terragrunt module that should be deployed depending on the path
# changed in the repo or the branch we're on. For now it's hard-coded to `hub/dev`
on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- docs/**
- .github/workflows/docs-deploy.yml
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- main
# from https://github.com/reviewdog/action-eslint/issues/29#issuecomment-985939887
types:
- opened
- reopened
- synchronize
- ready_for_review
defaults:
run:
working-directory: docs/
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# leveraging a paths-filter approach to be able to make this run required for all PRs while still
# not blocking merging with "Expected" for those runs that have a paths filter
# FUTURE eventually github will likely fix this
# https://github.com/orgs/community/discussions/26698
paths_filter:
if: github.event.pull_request.draft == false || github.ref == 'refs/heads/main'
runs-on: 'ai-platform-dev-gha-runner-scale-set'
permissions:
pull-requests: read
contents: 'read'
outputs:
changed: ${{ steps.changes.outputs.src }}
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
# required to get full history of docs and thus creation date of files
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- docs/
- .github/workflows/docs-deploy.yml
build_and_deploy:
environment: dev
needs: [paths_filter]
runs-on: ai-platform-dev-gha-runner-scale-set
name: Build Documentation
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
# build Docs
- name: Build Docs
env:
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.actor == 'dependabot[bot]' && secrets.GITHUB_TOKEN || secrets.PAT }}
run: |
pip install uv
make build #builds the static files in site/
- uses: 'google-github-actions/auth@v2'
if: github.ref == 'refs/heads/main'
with:
project_id: ${{vars.PROJECT_ID}}
workload_identity_provider: ${{vars.WORKLOAD_IDENTITY_PROVIDER_RW}}
service_account: ${{vars.SERVICE_ACCOUNT_RW}}
# To prevent hitting the limit of 210 versions on Google App Engine
- name: Limit the Number of Versions on Google App Engine
if: github.ref == 'refs/heads/main'
env:
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.PAT }}
run:
make clean_versions
# https://github.com/google-github-actions/deploy-appengine
- id: 'deploy'
if: github.ref == 'refs/heads/main'
uses: 'google-github-actions/deploy-appengine@v2'
with:
project_id: ${{ vars.PROJECT_ID }}
working_directory: docs/ #ignores above setting