Repository navigation
121 lines (105 loc) · 3.2 KB
/
Copy pathdocs.yml
File metadata and controls
121 lines (105 loc) · 3.2 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
116
117
118
119
120
121
# Builds the documentation site with DocFX, deploys it to GitHub Pages, and mirrors
# the Markdown sources to the repository wiki.
#
# Requirements (see docs/release-process.md):
# - Settings -> Pages -> Source: GitHub Actions
# - Settings -> Features -> Wikis enabled, with at least one wiki page created so
# the wiki repository exists and can be cloned.
# - Actions secret WIKI_TOKEN: a classic PAT with the `repo` scope. When the secret
# is not configured, the wiki job is skipped with a message instead of failing.
name: Docs
on:
push:
branches: ["master"]
paths:
- "docs/**"
- "scripts/publish-wiki.ps1"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
env:
DOCFX_VERSION: 2.81.0
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Install DocFX
run: dotnet tool install --global docfx --version ${{ env.DOCFX_VERSION }}
- name: Build site
run: docfx docs/docfx.json
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/_site
deploy-pages:
name: Deploy to GitHub Pages
needs: [build]
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v5
wiki:
name: Publish wiki
runs-on: ubuntu-latest
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Check for wiki token
id: token
shell: bash
run: |
if [ -z "${WIKI_TOKEN}" ]; then
echo "WIKI_TOKEN is not configured; skipping the wiki publish."
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
- name: Clone wiki
if: steps.token.outputs.skip != 'true'
shell: bash
run: |
git clone "https://x-access-token:${WIKI_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git" wiki
- name: Sync documentation
if: steps.token.outputs.skip != 'true'
shell: pwsh
run: >
./scripts/publish-wiki.ps1
-SourceDirectory docs
-WikiDirectory wiki
-NavigationFile docs/guide/toc.yml
- name: Commit and push
if: steps.token.outputs.skip != 'true'
working-directory: wiki
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --all
if git diff --cached --quiet; then
echo "The wiki is already up to date."
else
git commit -m "docs: sync wiki from ${GITHUB_SHA}"
git push
fi