-
Notifications
You must be signed in to change notification settings - Fork 154
86 lines (72 loc) · 2.07 KB
/
documentation.yml
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
name: docswithmkdoc
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
# files that affect the docs build:
- docs/**
- CONTRIBUTING.md
- mkdocs.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('scripts/docs-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: tree docs/
- name: Install docs dependencies
run: |
pip install --upgrade pip
pip install -r scripts/docs-requirements.txt
- name: Build documentation
run: mkdocs build
- name: Check links
uses: lycheeverse/[email protected]
with:
fail: false
args: --offline site/ --verbose './**/*.html'
- name: Upload built site
uses: actions/[email protected]
with:
name: built_site
path: site
# some environment info
- run: pip freeze
- run: mkdocs --version
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
with:
name: built_site
path: site
- name: commit and force-push to gh-pages branch
run: |
pip install ghp-import==2.1.0
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
ghp-import -opfm "Update docs from commit ${{ github.sha }}" site