-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (93 loc) · 3 KB
/
Copy pathdocs.yml
File metadata and controls
114 lines (93 loc) · 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
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
name: Docs
on:
push:
branches: [ master ]
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'scripts/Sync-Wiki.ps1'
- '.github/workflows/docs.yml'
workflow_dispatch:
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build documentation site
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install MkDocs Material
run: pip install -r docs/requirements.txt
- name: Build site
run: mkdocs build --strict
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
name: Deploy to GitHub Pages
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@v4
wiki:
name: Sync GitHub wiki
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check wiki token
id: wiki-token
shell: pwsh
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
run: |
if ([string]::IsNullOrWhiteSpace($env:WIKI_TOKEN)) {
Write-Host 'WIKI_TOKEN secret is not set; skipping wiki synchronization.'
'available=false' >> $env:GITHUB_OUTPUT
} else {
'available=true' >> $env:GITHUB_OUTPUT
}
- name: Generate wiki pages
if: steps.wiki-token.outputs.available == 'true'
shell: pwsh
run: ./scripts/Sync-Wiki.ps1 -OutputPath wiki-out
- name: Publish wiki
if: steps.wiki-token.outputs.available == 'true'
shell: pwsh
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
run: |
$wikiUrl = "https://x-access-token:$env:WIKI_TOKEN@github.com/${{ github.repository }}.wiki.git"
git clone --depth 1 $wikiUrl wiki-repo
if ($LASTEXITCODE -ne 0) {
throw 'Could not clone the wiki repository. Create the first wiki page in the web UI and try again.'
}
Get-ChildItem -LiteralPath wiki-repo -Force |
Where-Object { $_.Name -ne '.git' } |
Remove-Item -Recurse -Force
Copy-Item -Path (Join-Path 'wiki-out' '*') -Destination 'wiki-repo' -Recurse -Force
git -C wiki-repo config user.name 'github-actions[bot]'
git -C wiki-repo config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git -C wiki-repo add -A
if (git -C wiki-repo status --porcelain) {
git -C wiki-repo commit -m 'docs: sync wiki from documentation'
git -C wiki-repo push
} else {
Write-Host 'Wiki is already up to date.'
}