-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.59 KB
/
Copy pathdocs.yml
File metadata and controls
118 lines (99 loc) · 3.59 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
107
108
109
110
111
112
113
114
115
116
117
118
# Documentation build + deploy.
#
# Triggers:
# - pull_request to main: the ``build`` job runs to verify the docs
# compile; nothing is deployed. The built site is uploaded as a
# plain artifact so reviewers can download it.
# - push to main (typically a merged PR): the ``deploy`` job runs
# end-to-end (build + publish to GitHub Pages). No PR-time
# verification artifact is produced.
# - workflow_dispatch: manual deploy from the Actions UI.
#
# The build steps are shared between the two jobs but each job is gated
# to a single trigger, so a PR never deploys and a merge never produces
# a redundant verification artifact.
#
# IMPORTANT: GitHub Pages source must be set to "GitHub Actions" in the
# repository's Settings -> Pages page before the first deploy will
# succeed. Without this setting the deploy step's call to
# actions/deploy-pages@v4 fails with a 404.
name: docs
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
# Group every run of this workflow against the same ref under a single
# concurrency key. PRs cancel earlier in-flight runs (cheap and safe);
# pushes to main do NOT cancel because Pages deployments must not race
# against each other.
concurrency:
group: docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build (PR verification)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install package and docs / test extras
run: |
python -m pip install --upgrade pip
python -m pip install -e .[docs,test]
- name: Install Playwright Chromium
run: python -m playwright install chromium
- name: Generate user-guide screenshots
run: python scripts/generate_screenshots.py docs/source/_static/screenshots
- name: Build HTML site
run: python -m sphinx -W -b html docs/source docs/build/html
- name: Upload built site (PR preview)
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/build/html
deploy:
name: Deploy to GitHub Pages
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install package and docs / test extras
run: |
python -m pip install --upgrade pip
python -m pip install -e .[docs,test]
- name: Install Playwright Chromium
run: python -m playwright install chromium
- name: Generate user-guide screenshots
run: python scripts/generate_screenshots.py docs/source/_static/screenshots
- name: Build HTML site
run: python -m sphinx -W -b html docs/source docs/build/html
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4