Repository navigation
68 lines (59 loc) · 2.3 KB
/
Copy pathdocs.yml
File metadata and controls
68 lines (59 loc) · 2.3 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
name: docs
# Builds the documentation site on every change to docs on main, and publishes it to GitHub Pages once Pages is turned
# on (Settings → Pages → Source: GitHub Actions). Until then it only builds. On a pull request the site is built by CI
# (ci.yml, Other projects: the docs project's build target in docs/project.json), when the change affects it.
on:
push:
branches: [main]
paths: [docs/**, mkdocs.yml, overrides/**, README.md, CHANGELOG.md, .github/workflows/docs.yml]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pages: read
jobs:
build:
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
outputs:
publish: ${{ steps.pages.outputs.publish }}
steps:
- name: Is Pages turned on, publishing from Actions?
id: pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ github.token }}
run: |
if curl -fsS -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pages" 2>/dev/null | grep -q '"build_type": *"workflow"'; then
echo publish=true >>"$GITHUB_OUTPUT"
fi
- name: Checkout code
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-local-path: ${{ runner.environment == 'self-hosted' && format('{0}/uv-cache', runner.tool_cache) || '' }}
python-version: "3.12"
- name: Build the site (warnings fail it)
run: uvx --with "mkdocs-material>=9.6.9" mkdocs build --strict --site-dir site
- name: Keep the site for publishing
if: steps.pages.outputs.publish == 'true'
uses: actions/upload-pages-artifact@v5
with:
path: site
publish:
needs: build
if: needs.build.outputs.publish == 'true'
runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Publish to GitHub Pages
id: deploy
uses: actions/deploy-pages@v5