Skip to content

Commit e9f58b0

Browse files
committed
Add shared documentation build workflow template
This reusable workflow template consolidates the nearly identical docs.yml workflows across all 9 TSKit ecosystem repositories. Key benefits: - 82% reduction in workflow code duplication (~350 lines → 62 lines) - Single point of maintenance for documentation builds - Consistent behavior across all repositories - Preserved flexibility via input parameters The template supports all current customizations: - Custom requirements file paths - System dependencies (GSL, Doxygen, Tabix, SLiM, Playwright) - C module builds (make commands) - Automatic tskit-site rebuild triggering
1 parent 82f666b commit e9f58b0

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Documentation Build Template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
requirements-path:
7+
description: 'Path to documentation requirements file'
8+
required: false
9+
type: string
10+
default: 'requirements/CI-docs/requirements.txt'
11+
additional-setup:
12+
description: 'Additional setup commands to run'
13+
required: false
14+
type: string
15+
default: ''
16+
make-command:
17+
description: 'Make command for C modules'
18+
required: false
19+
type: string
20+
default: ''
21+
22+
jobs:
23+
build-deploy-docs:
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- uses: styfle/[email protected]
27+
with:
28+
access_token: ${{ github.token }}
29+
30+
- uses: actions/[email protected]
31+
with:
32+
submodules: true
33+
fetch-depth: 0
34+
35+
- uses: actions/[email protected]
36+
with:
37+
python-version: '3.11'
38+
cache: 'pip'
39+
cache-dependency-path: ${{ inputs.requirements-path }}
40+
41+
- name: Install documentation dependencies
42+
run: pip install -r ${{ inputs.requirements-path }}
43+
44+
- name: Additional setup
45+
if: inputs.additional-setup != ''
46+
run: ${{ inputs.additional-setup }}
47+
48+
- name: Build C modules
49+
if: inputs.make-command != ''
50+
run: ${{ inputs.make-command }}
51+
52+
- name: Build documentation
53+
run: cd docs && make
54+
55+
- name: Trigger tskit-site rebuild
56+
if: github.ref == 'refs/heads/main'
57+
run: |
58+
curl -X POST https://api.github.com/repos/tskit-dev/tskit-site/dispatches \
59+
-H 'Accept: application/vnd.github.everest-preview+json' \
60+
-u AdminBot-tskit:${{ secrets.ADMINBOT_TOKEN }} \
61+
--data '{"event_type":"build-docs"}'

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
# .github
22
Defaults for github shared across tskit-dev repositories
3+
4+
### Documentation Build Template
5+
6+
**File:** `.github/workflows/docs-build-template.yml`
7+
8+
A reusable workflow for building documentation across all TSKit ecosystem repositories. This eliminates duplication of nearly identical documentation workflows.
9+
10+
**Usage:**
11+
```yaml
12+
jobs:
13+
docs:
14+
uses: tskit-dev/.github/.github/workflows/docs-build-template.yml@main
15+
with:
16+
requirements-path: requirements/CI-docs/requirements.txt # optional
17+
additional-setup: sudo apt-get install -y libgsl0-dev # optional
18+
make-command: make -C python # optional
19+
```
20+
**Parameters:**
21+
- `requirements-path`: Path to documentation requirements file (default: `requirements/CI-docs/requirements.txt`)
22+
- `additional-setup`: Additional setup commands (system packages, special builds, etc.)
23+
- `make-command`: Make command for building C modules before docs

0 commit comments

Comments
 (0)