-
Notifications
You must be signed in to change notification settings - Fork 15
71 lines (60 loc) · 1.88 KB
/
docs.yml
File metadata and controls
71 lines (60 loc) · 1.88 KB
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
name: Documentation
on:
push:
branches: [main]
paths:
- "docs/**"
- "scripts/prepare_gitbook_site.py"
- "scripts/check_docs.py"
- ".gitbook.yaml"
- "Justfile"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "docs/**"
- "scripts/prepare_gitbook_site.py"
- "scripts/check_docs.py"
- ".gitbook.yaml"
- "Justfile"
- ".github/workflows/docs.yml"
workflow_dispatch:
jobs:
docs:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
run: python -m pip install uv
- name: Sync Python dependencies
run: uv sync --locked
- name: Check documentation links
run: uv run python scripts/check_docs.py
- name: Build GitBook site
run: uv run python scripts/prepare_gitbook_site.py
- name: Deploy to gitbook-docs branch
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
mv site/ /tmp/gitbook-site/
git fetch origin gitbook-docs || true
if git rev-parse --verify origin/gitbook-docs >/dev/null 2>&1; then
git checkout gitbook-docs
else
git checkout --orphan gitbook-docs
git rm -rf .
fi
rsync -a --delete --exclude='.git' /tmp/gitbook-site/ .
git add -A
if ! git diff --cached --quiet; then
git commit -m "docs: update GitBook documentation from ${{ github.sha }}"
git push origin gitbook-docs
fi