-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (123 loc) · 4.72 KB
/
Copy pathdocs.yml
File metadata and controls
146 lines (123 loc) · 4.72 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
137
138
139
140
141
142
143
144
145
146
name: Documentation
on:
push:
branches: [master, main, dev]
paths:
- "docs/**"
- "mkdocs.yml"
- "python/tryx/**"
pull_request:
branches: [master, main, dev]
paths:
- "docs/**"
- "mkdocs.yml"
- "python/tryx/**"
workflow_dispatch:
inputs:
version:
description: "Version to deploy (e.g. 0.7, 0.8)"
required: false
type: string
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Job 1: Validate (runs on PR + push) ────────────────────────────────────
validate:
name: Validate Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v5
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: uv sync --group dev --group docs --no-install-project
- name: Validate .pyi stubs with pyright
run: |
uv run --no-project pyright python/tryx/client.pyi \
python/tryx/events.pyi \
python/tryx/types.pyi \
python/tryx/wacore.pyi \
python/tryx/helpers.pyi \
python/tryx/backend.pyi \
python/tryx/exceptions.pyi \
python/tryx/__init__.pyi \
python/tryx/tryx.pyi \
python/tryx/media.pyi
- name: Validate .pyi stubs with mypy
run: |
uv run --no-project mypy python/tryx/client.pyi \
python/tryx/events.pyi \
python/tryx/types.pyi \
python/tryx/wacore.pyi \
python/tryx/helpers.pyi \
python/tryx/backend.pyi \
python/tryx/exceptions.pyi \
python/tryx/__init__.pyi \
python/tryx/tryx.pyi \
python/tryx/media.pyi \
--ignore-missing-imports
- name: Build docs (validation only)
run: uv run --no-project zensical build -f mkdocs.yml -s
# ── Job 2: Deploy (runs on push or manual trigger) ─────────────────────────
deploy:
name: Deploy Documentation
needs: validate
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: uv sync --group dev --group docs --no-install-project
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Auto-deploy from tag → versioned docs (e.g. v0.8.0 → "0.8")
- name: Deploy versioned docs (from tag)
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//' | sed 's/\.[0-9]*$//')
echo "Deploying docs for version: $VERSION"
uv run --no-project mike deploy --push --update-aliases "$VERSION" latest
uv run --no-project mike set-default --push latest
# Auto-deploy from master → "dev" version
- name: Deploy dev docs (from master)
if: "!startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'"
run: |
echo "Deploying docs as dev"
uv run --no-project mike deploy --push --update-aliases dev latest
uv run --no-project mike set-default --push latest
# Manual deploy with custom version
- name: Deploy custom version (manual)
if: github.event_name == 'workflow_dispatch' && inputs.version != ''
run: |
echo "Deploying docs for version: ${{ inputs.version }}"
uv run --no-project mike deploy --push --update-aliases "${{ inputs.version }}" latest
uv run --no-project mike set-default --push latest
# Manual deploy without version → deploy as dev
- name: Deploy dev docs (manual)
if: github.event_name == 'workflow_dispatch' && inputs.version == ''
run: |
echo "Deploying docs as dev"
uv run --no-project mike deploy --push --update-aliases dev latest
uv run --no-project mike set-default --push latest
- name: List deployed versions
if: success()
run: uv run --no-project mike list