-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.35 KB
/
docs.yml
File metadata and controls
87 lines (76 loc) · 2.35 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
name: docs
# Build the docs site and publish it to GitHub Pages via the Actions
# deploy flow.
#
# The built site is also committed under gh-pages/public/ for diff
# visibility — the workflow fails on PR if that committed copy is out of
# sync with what `gh-pages/build_site.py` would produce, so reviewers see
# the visible-output delta in PR diffs.
#
# Pages source must be set to "GitHub Actions" once:
# Settings → Pages → Source = GitHub Actions
# (or: gh api -X POST repos/<owner>/<repo>/pages -f build_type=workflow)
on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'gh-pages/**'
- '.github/workflows/docs.yml'
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- 'gh-pages/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deploy; don't cancel an in-flight production
# publish, just queue behind it.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build docs site
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: gh-pages/requirements.txt
- name: Install builder deps
run: pip install -r gh-pages/requirements.txt
- name: Build site
run: python3 gh-pages/build_site.py
- name: Fail if committed gh-pages/public/ is stale
run: |
if ! git diff --quiet gh-pages/public/; then
echo "::error::gh-pages/public/ is out of sync with docs/ or gh-pages/ sources."
echo "Run 'python3 gh-pages/build_site.py' locally and commit the result before pushing."
git --no-pager diff --stat gh-pages/public/
exit 1
fi
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: gh-pages/public
deploy:
name: Deploy to GitHub Pages
needs: build
# Only deploy from main, not from PR builds.
if: github.event_name != 'pull_request'
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5