-
Notifications
You must be signed in to change notification settings - Fork 242
136 lines (117 loc) · 3.9 KB
/
Copy pathdocs.yml
File metadata and controls
136 lines (117 loc) · 3.9 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: docs
on:
push:
branches:
- master
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
environment: docs
strategy:
matrix:
python-version: ['3.14']
steps:
- uses: actions/checkout@v6
- name: Filter changed file paths to outputs
uses: dorny/paths-filter@v4.0.1
id: changes
with:
filters: |
root_docs:
- CHANGES
- README.*
docs:
- 'docs/**'
- 'examples/**'
python_files:
- 'src/tmuxp/**'
- pyproject.toml
- uv.lock
- name: Should publish
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
if: env.PUBLISH == 'true'
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
if: env.PUBLISH == 'true'
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
if: env.PUBLISH == 'true'
run: uv sync --all-extras --dev
- name: Install just
if: env.PUBLISH == 'true'
uses: extractions/setup-just@v4
- name: Set up Node.js
if: env.PUBLISH == 'true'
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Set up pnpm
if: env.PUBLISH == 'true'
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false
- name: Cache Puppeteer browser
if: env.PUBLISH == 'true'
uses: actions/cache@v5
with:
path: ~/.cache/puppeteer
key: puppeteer-${{ runner.os }}-${{ hashFiles('docs/pnpm-lock.yaml') }}
restore-keys: |
puppeteer-${{ runner.os }}-
# Diagrams (docs/_ext/mermaid_inline.py) are rendered at build time by
# mmdc, which drives a headless Chrome. Without it the build still
# succeeds but degrades diagrams to a text fallback, so provision both.
- name: Install diagram toolchain (mermaid-cli + Chrome)
if: env.PUBLISH == 'true'
run: |
pnpm -C docs install --frozen-lockfile
pnpm -C docs rebuild puppeteer
pnpm -C docs exec mmdc --version
- name: Print python versions
if: env.PUBLISH == 'true'
run: |
python -V
uv run python -V
- name: Cache sphinx fonts
if: env.PUBLISH == 'true'
uses: actions/cache@v5
with:
path: ~/.cache/sphinx-fonts
key: sphinx-fonts-${{ hashFiles('docs/conf.py') }}
restore-keys: |
sphinx-fonts-
- name: Build documentation
if: env.PUBLISH == 'true'
run: |
cd docs && just html
- name: Configure AWS Credentials
if: env.PUBLISH == 'true'
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.TMUXP_DOCS_ROLE_ARN }}
aws-region: us-east-1
- name: Push documentation to S3
if: env.PUBLISH == 'true'
run: |
aws s3 sync docs/_build/html "s3://${{ secrets.TMUXP_DOCS_BUCKET }}" \
--delete --follow-symlinks
- name: Invalidate CloudFront
if: env.PUBLISH == 'true'
run: |
aws cloudfront create-invalidation \
--distribution-id "${{ secrets.TMUXP_DOCS_DISTRIBUTION }}" \
--paths "/index.html" "/history.html" "/objects.inv" "/searchindex.js"
- name: Purge cache on Cloudflare
if: env.PUBLISH == 'true'
uses: jakejarvis/cloudflare-purge-action@v0.3.0
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}