Repository navigation
85 lines (73 loc) · 2.47 KB
/
Copy pathdocs.yml
File metadata and controls
85 lines (73 loc) · 2.47 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
name: Docs
on:
workflow_call:
workflow_dispatch:
push:
branches: [master]
paths:
- 'docs/**'
- 'WhatsNew.md'
- '.github/workflows/docs.yml'
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
pages:
name: Deploy documentation site
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install docfx
run: dotnet tool install --global docfx
- name: Sync changelog from WhatsNew
run: cp WhatsNew.md docs/changelog.md
- name: Build documentation
run: docfx docs/docfx.json
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
wiki:
name: Deploy GitHub wiki
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish documentation to the wiki
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
if ! git clone --depth 1 "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git" wiki; then
echo "::warning::The repository wiki is not initialized yet. Open https://github.com/${GITHUB_REPOSITORY}/wiki, create the first page, and re-run this workflow. The wiki pages are generated from docs/."
exit 0
fi
find wiki -maxdepth 1 -name '*.md' -delete
rm -rf wiki/images
cp docs/*.md wiki/
cp docs/_Sidebar.md wiki/_Sidebar.md
cp WhatsNew.md wiki/changelog.md
mkdir -p wiki/images
cp docs/images/* wiki/images/
mv wiki/index.md wiki/Home.md
# GitHub wiki links are extension-less: [Page](page.md) -> [Page](page)
find wiki -maxdepth 1 -name '*.md' -print0 | xargs -0 sed -i -E 's/\]\(([^):#]+)\.md(#[^)]*)?\)/](\1\2)/g'
cd wiki
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git diff --cached --quiet || git commit -m "Update wiki from docs (${GITHUB_REF_NAME})"
git push