1- name : Publish Docs
1+ name : Docs
22
33on :
44 workflow_dispatch :
55 release :
6- types : [published]
6+ types : [ published ]
7+ pull_request :
8+ branches :
9+ - main
710
811jobs :
9- deploy :
10-
12+ build :
13+ name : Build documentation
1114 runs-on : ubuntu-latest
1215
1316 defaults :
@@ -18,42 +21,58 @@ jobs:
1821 - uses : actions/checkout@v4
1922
2023 - name : Set up Python
21- uses : actions/setup-python@v4
24+ uses : actions/setup-python@v6
2225 with :
2326 python-version : " 3.x"
27+
2428 - name : Install client and dependencies
2529 working-directory : " ./"
2630 run : |
2731 python -m pip install --upgrade pip setuptools
2832 pip install .
33+
2934 - name : Install docs dependencies
3035 run : |
3136 pip install -r requirements-docs.txt
37+
3238 - name : Build documentation
33- run : make html
39+ run : SPHINXOPTS="-W" make html
3440
35- # - name: Upload docs as artifact
36- # uses: actions/upload-artifact@v3
37- # with:
38- # name: docs
39- # path: docs/build
41+ - name : Upload build artifact
42+ if : github.event_name == 'release' || github.event_name == 'workflow_dispatch'
43+ uses : actions/upload-artifact@v4
44+ with :
45+ name : docs-html
46+ path : docs/build/html
47+
48+ deploy :
49+ name : Deploy documentation
50+ needs : build
51+ if : github.event_name == 'release' || github.event_name == 'workflow_dispatch'
52+ runs-on : ubuntu-latest
53+
54+ steps :
55+ - name : Download build artifact
56+ uses : actions/download-artifact@v4
57+ with :
58+ name : docs-html
59+ path : docs-html
4060
4161 - name : Authenticate with Google
4262 uses : " google-github-actions/auth@v2"
4363 with :
4464 project_id : ${{ secrets.GCS_PROJECT }}
4565 credentials_json : ${{ secrets.GCS_SERVICE_ACCOUNT_ACCESS_KEY }}
4666
47- - name : ' Set up Cloud SDK'
48- uses : ' google-github-actions/setup-gcloud@v2'
67+ - name : Set up Cloud SDK
68+ uses : " google-github-actions/setup-gcloud@v2"
4969
5070 - name : Upload to Google Cloud Storage
5171 env :
5272 UPLOAD_PATH : ${{ format('gs://{0}/docs/client', secrets.DOCS_BUCKET) }}
53- run : gsutil -m rsync -d -r build/ html $UPLOAD_PATH
73+ run : gsutil -m rsync -d -r docs- html $UPLOAD_PATH
5474
5575 - name : Invalidate CDN Cache
5676 env :
5777 LOAD_BALANCER : ${{ secrets.LOAD_BALANCER_NAME }}
5878 run : gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --async --path "/docs/client/*"
59-
0 commit comments