-
-
Notifications
You must be signed in to change notification settings - Fork 100
132 lines (112 loc) · 3.92 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
120
121
122
123
124
125
126
127
128
129
130
131
132
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@v3
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@v4
with:
python-version: '3.8'
# install pip=>20.1 to use "pip cache dir"
- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install mkdocs mkdocs-material
- name: Rebuild website
run: make _website_build
- uses: actions/upload-artifact@v3
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@v3
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