Skip to content

Commit 3de6ce8

Browse files
committed
ci: separate doc check into ci-docs.yml (read-only) and deploy into cd-docs.yml (push-only)
1 parent e3cc1a4 commit 3de6ce8

2 files changed

Lines changed: 47 additions & 6 deletions

File tree

.github/workflows/cd-docs.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- 'master'
7-
pull_request:
87

98
permissions:
109
contents: write
@@ -25,6 +24,7 @@ jobs:
2524
cache: 'pip'
2625
cache-dependency-path: |
2726
setup.py
27+
requirements-docs.txt
2828
2929
- name: Save time for cache for mkdocs
3030
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
@@ -41,12 +41,7 @@ jobs:
4141
run: pip install -r requirements-docs.txt
4242

4343
- name: Deploy to GitHub Pages
44-
if: (github.event_name != 'pull_request')
4544
run: |
4645
git config user.name github-actions[bot]
4746
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
4847
mkdocs gh-deploy --force
49-
50-
- name: Build docs to check for errors
51-
run: mkdocs build
52-
if: (github.event_name == 'pull_request')

.github/workflows/ci-docs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: ci-docs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
steps:
17+
- name: Checkout repo
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
persist-credentials: false
21+
22+
- name: Set up Python 3.12
23+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
24+
with:
25+
python-version: '3.12'
26+
cache: 'pip'
27+
cache-dependency-path: |
28+
setup.py
29+
requirements-docs.txt
30+
31+
- name: Save time for cache for mkdocs
32+
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
33+
34+
- name: Caching
35+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
36+
with:
37+
key: mkdocs-material-${{ env.cache_id }}
38+
path: .cache
39+
restore-keys: |
40+
mkdocs-material-
41+
42+
- name: Install Dependencies
43+
run: pip install -r requirements-docs.txt
44+
45+
- name: Build docs to check for errors
46+
run: mkdocs build

0 commit comments

Comments
 (0)