-
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 2.26 KB
/
mkdocs-build.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
87
name: Build Docs
on:
workflow_dispatch:
push:
paths:
- 'docs/**'
- '.github/workflows/mkdocs-build.yml'
- 'docs/requirements.txt'
branches: [ main ]
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- '.github/workflows/mkdocs-build.yml'
- 'docs/requirements.txt'
pull_request_review:
types: [edited, dismissed]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: '0'
# setup python
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.*
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -U pip wheel
python -m pip install -r docs/requirements.txt
pip show mkdocs-material
- name: mkdocs build
run: mkdocs build -f docs/mkdocs.yml --clean --verbose -d generated
- name: Include _headers file
run: cp docs/_headers docs/generated/_headers
- name: Publish to Cloudflare Pages
if: github.event_name != 'pull_request'
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: docs/generated
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Publish preview to Cloudflare Pages
if: github.event_name == 'pull_request'
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: docs/generated
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref.name }}
- name: Cache pip files
uses: actions/[email protected]
env:
cache-name: pip-reg
with:
path: $HOME/.cache/pip
key: pip-reg
- name: Cache Mkdocs files
uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache