-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 1.75 KB
/
docs.yaml
File metadata and controls
67 lines (56 loc) · 1.75 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
name: Docs
# Build API reference docs with pdoc on every push to main.
# On push: build + deploy to GitHub Pages (gh-pages branch).
# On PR: build only (smoke test, no deploy).
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write # needed to push to gh-pages
jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install package and pdoc
run: |
pip install -e ".[dev]"
pip install pdoc
- name: Build HTML docs
# pdoc 14+ writes directly to -o dir; --no-show-source keeps output clean
run: pdoc --output-directory site --no-show-source kb_cloud_client
- name: Add .nojekyll (required for GitHub Pages)
run: touch site/.nojekyll
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: site/
if-no-files-found: error
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs-html
path: site/
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
# Orphan branch keeps gh-pages history small
force_orphan: true
enable_jekyll: false
commit_message: "docs: ${{ github.event.head_commit.message }}"