Skip to content

Commit 1b51441

Browse files
committed
docs(ci): Add docs deployment workflow
why: Deploy Sphinx docs to S3/CloudFront on push to main. what: - Add docs.yml workflow matching libtmux's pattern - Uses OIDC for AWS auth, paths-filter for change detection - Triggers on main branch (not master) - Secret names: LIBTMUX_MCP_DOCS_ROLE_ARN, LIBTMUX_MCP_DOCS_BUCKET, LIBTMUX_MCP_DOCS_DISTRIBUTION
1 parent 58908a7 commit 1b51441

1 file changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
environment: docs
16+
strategy:
17+
matrix:
18+
python-version: ['3.14']
19+
steps:
20+
- uses: actions/checkout@v6
21+
22+
- name: Filter changed file paths to outputs
23+
uses: dorny/paths-filter@v3.0.2
24+
id: changes
25+
with:
26+
filters: |
27+
root_docs:
28+
- CHANGES
29+
- README.*
30+
docs:
31+
- 'docs/**'
32+
python_files:
33+
- 'src/libtmux_mcp/**'
34+
- uv.lock
35+
- pyproject.toml
36+
37+
- name: Should publish
38+
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
39+
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
40+
41+
- name: Install uv
42+
if: env.PUBLISH == 'true'
43+
uses: astral-sh/setup-uv@v7
44+
with:
45+
enable-cache: true
46+
47+
- name: Set up Python ${{ matrix.python-version }}
48+
if: env.PUBLISH == 'true'
49+
run: uv python install ${{ matrix.python-version }}
50+
51+
- name: Install dependencies [w/ docs]
52+
if: env.PUBLISH == 'true'
53+
run: uv sync --all-extras --dev
54+
55+
- name: Install just
56+
if: env.PUBLISH == 'true'
57+
uses: extractions/setup-just@v3
58+
59+
- name: Print python versions
60+
if: env.PUBLISH == 'true'
61+
run: |
62+
python -V
63+
uv run python -V
64+
65+
- name: Cache sphinx fonts
66+
if: env.PUBLISH == 'true'
67+
uses: actions/cache@v5
68+
with:
69+
path: ~/.cache/sphinx-fonts
70+
key: sphinx-fonts-${{ hashFiles('docs/conf.py') }}
71+
restore-keys: |
72+
sphinx-fonts-
73+
74+
- name: Build documentation
75+
if: env.PUBLISH == 'true'
76+
run: |
77+
cd docs && just html
78+
79+
- name: Configure AWS Credentials
80+
if: env.PUBLISH == 'true'
81+
uses: aws-actions/configure-aws-credentials@v5
82+
with:
83+
role-to-assume: ${{ secrets.LIBTMUX_MCP_DOCS_ROLE_ARN }}
84+
aws-region: us-east-1
85+
86+
- name: Push documentation to S3
87+
if: env.PUBLISH == 'true'
88+
run: |
89+
aws s3 sync docs/_build/html "s3://${{ secrets.LIBTMUX_MCP_DOCS_BUCKET }}" \
90+
--delete --follow-symlinks
91+
92+
- name: Invalidate CloudFront
93+
if: env.PUBLISH == 'true'
94+
run: |
95+
aws cloudfront create-invalidation \
96+
--distribution-id "${{ secrets.LIBTMUX_MCP_DOCS_DISTRIBUTION }}" \
97+
--paths "/index.html" "/objects.inv" "/searchindex.js"
98+
99+
- name: Purge cache on Cloudflare
100+
if: env.PUBLISH == 'true'
101+
uses: jakejarvis/cloudflare-purge-action@v0.3.0
102+
env:
103+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
104+
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}

0 commit comments

Comments
 (0)