Repository navigation
115 lines (95 loc) · 2.74 KB
/
Copy pathdocs.yml
File metadata and controls
115 lines (95 loc) · 2.74 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
name: Documentation
on:
push:
branches: [master, main]
paths:
- "docs/**"
- "mkdocs.yml"
- "requirements-docs.txt"
- "scripts/build-wiki.py"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install MkDocs Material
run: pip install -r requirements-docs.txt
- name: Build site
run: python -m mkdocs build --strict
- name: Build wiki payload
run: python scripts/build-wiki.py
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: _site
- name: Upload wiki payload
uses: actions/upload-artifact@v7
with:
name: wiki-payload
path: wiki-build/
if-no-files-found: error
deploy:
name: Deploy documentation
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
wiki:
name: Deploy GitHub Wiki
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Download wiki payload
uses: actions/download-artifact@v8
with:
name: wiki-payload
path: wiki-build
- name: Publish wiki
shell: bash
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
WIKI_URL="https://x-access-token:${WIKI_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git"
if ! git clone "$WIKI_URL" wiki; then
echo "Wiki repository is not initialized; initialize it once from the GitHub UI." >&2
exit 1
fi
find wiki -maxdepth 1 -type f -name '*.md' -delete
cp wiki-build/*.md wiki/
cd wiki
git add -A
if git diff --cached --quiet; then
echo "Wiki is already up to date."
exit 0
fi
git commit -m "docs: sync wiki from ${GITHUB_SHA::7}"
git push