-
-
Notifications
You must be signed in to change notification settings - Fork 100
119 lines (101 loc) · 3.39 KB
/
docs.yaml
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
name: Docs
on:
push:
branches:
- main
pull_request: ~
# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
TERM: xterm
jobs:
check-markdown:
name: Lint Markdown
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Markdown formatting
uses: DavidAnson/[email protected]
with:
globs: "*.md|doc/**/*.md"
check-links:
name: Lint Links
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run Lychee
uses: lycheeverse/[email protected]
with:
# To keep in sync with Makefile#lychee
args: "--verbose --no-progress '*.md' 'doc/**/*.md' --cache --max-cache-age 1d ."
output: ${{ runner.temp }}/lychee/out.md
fail: true
build:
runs-on: ubuntu-latest
name: Build docs
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Display pip version
run: pip --version
- name: Install dependencies
run: python3 -m pip install mkdocs mkdocs-material
- name: Rebuild website
run: make _website_build
- uses: actions/upload-artifact@v4
name: Upload the docs artifact
with:
name: docs-website
path: dist/website
# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the tests one above which
# may change regularly.
validate-docs:
name: Docs status
runs-on: ubuntu-latest
needs:
- check-markdown
- check-links
- build
if: always()
steps:
- name: Successful run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
deploy:
runs-on: ubuntu-latest
name: Deploy website
permissions:
contents: write
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v4
with:
name: docs-website
path: dist/website
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist/website