Repository navigation
71 lines (65 loc) · 2.46 KB
/
Copy pathdocs.yml
File metadata and controls
71 lines (65 loc) · 2.46 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
name: docs
# Every PR builds and strict-validates the MkDocs site. Pushes to main also deploy.
# Deploy used to be manual-only, so that a push could not fail on a repository
# where Pages was off. Pages is on now, and the guard had outlived it: the site
# went stale silently, and README links to pages that only existed in the
# source tree returned 404 -- which is worse than the red run it was avoiding.
# `workflow_dispatch` is kept for re-publishing without a commit.
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
# PR runs cancel only earlier runs for the same PR. Main/manual Pages runs
# keep their existing group and cannot be canceled by a PR validation.
group: ${{ github.event_name == 'pull_request' && format('pages-pr-{0}', github.event.pull_request.number) || 'pages' }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: node --test tests/javascript/experience.test.cjs
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# cairosvg loads libcairo at runtime; the social plugin needs it to
# render the per-page cards, and the build fails without it.
- run: sudo apt-get update && sudo apt-get install -y libcairo2
- run: pip install "mkdocs-material[imaging]>=9.5" playwright
- run: python -m playwright install --with-deps chromium
- run: mkdocs build --clean --strict
- run: python tests/test_site_navigation.py site
- run: python tools/check_site_layout.py site
- uses: actions/upload-artifact@v4
if: always()
with:
name: site-layout-screenshots
path: layout-screenshots
if-no-files-found: ignore
- uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
needs: build
# A push to main, or a manual re-publish. Anything else -- a PR build --
# validates and stops, because a fork's build must never reach Pages.
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4