-
Notifications
You must be signed in to change notification settings - Fork 27
86 lines (68 loc) · 2.42 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
86 lines (68 loc) · 2.42 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
# .github/workflows/deploy-docs.yml
name: Deploy Docs (on latest push to main branch)
# It builds and deploys the latest version of the documentation to GitHub Pages.
# IMPORTANT: Ensure Repo Settings / Pages / Build and deployment / Set Source to `GitHub Actions`.
# CI PHASES A-B-C-D:
# - Assemble: Install dependencies, verify environment setup
# - Baseline: Core validation (types exist, lint passes, tests pass)
# - Coverage: Generate reports and upload artifacts
# - Deploy: Build package and docs (sanity checks for release readiness)
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write # gh-pages deployment
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1" # real-time logging
PYTHONIOENCODING: "utf-8"
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# ------------------- ASSEMBLE -------------------
- name: A1) Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for tags
- name: A2) Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: A3) Pin Python version for consistency
run: uv python pin 3.12
- name: A4) Sync to install dependencies
run: uv sync --extra dev --extra docs --upgrade
# ------------------- BASELINE CHECKS -------------------
- name: B1) Fail fast if no MkDocs configuration
run: |
if [ -f "mkdocs.yml" ] || [ -f "mkdocs.yaml" ]; then
echo "MkDocs configuration found. Proceeding."
else
echo "ERROR: mkdocs.yml not found."
echo "If you do not want documentation deployment,"
echo "delete .github/workflows/deploy-docs.yml (or add mkdocs.yml)."
exit 1
fi
# ------------ DEPLOY ------------------
- name: D1) Build docs (mkdocs --strict)
run: uv run mkdocs build --strict
- name: D2) Assert site artifact exists
run: |
test -d site && test -f site/index.html || {
echo "ERROR: MkDocs build produced no site/index.html"
exit 1
}
- name: D3) Upload site as artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
- name: D4) Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4