-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (80 loc) · 2.83 KB
/
deploy-docs.yml
File metadata and controls
94 lines (80 loc) · 2.83 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
# SPDX-FileCopyrightText: 2026 PythonWoods <dev@pythonwoods.dev>
# SPDX-License-Identifier: Apache-2.0
name: Deploy Documentation to Cloudflare Pages
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'README.md'
- 'CHANGELOG.md'
- 'SECURITY.md'
- 'noxfile.py'
- '.github/workflows/deploy-docs.yml'
pull_request:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'README.md'
- 'CHANGELOG.md'
- 'SECURITY.md'
- 'noxfile.py'
- '.github/workflows/deploy-docs.yml'
workflow_dispatch: # Manual trigger
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
UV_SYSTEM_PYTHON: 0
PYTHONUNBUFFERED: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-suffix: "docs"
- name: Set up Python 3.11
run: uv python install 3.11
- name: Install Dependencies
run: uv sync --group dev
- name: Download Lucide Icons
run: |
mkdir -p overrides/.icons/lucide
ASSET_URL=$(curl -sf https://api.github.com/repos/lucide-icons/lucide/releases/latest \
| python3 -c "import sys,json; r=json.load(sys.stdin); print(next(a['browser_download_url'] for a in r['assets'] if a['name'].startswith('lucide-icons') and a['name'].endswith('.zip')))")
curl -sL "$ASSET_URL" -o /tmp/lucide.zip
unzip -q /tmp/lucide.zip "*.svg" -d /tmp/lucide-extracted
find /tmp/lucide-extracted -name "*.svg" -exec cp {} overrides/.icons/lucide/ \;
- name: Package Brand Kit
run: |
mkdir -p docs/assets
cd docs/assets/brand
zip -r ../brand-kit.zip .
- name: Set docs version for topbar
run: |
VERSION=$(python3 -c "import tomllib; print('v' + tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "DOCS_VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: Build Documentation
run: uv run mkdocs build --strict
- name: Deploy to Cloudflare Pages
# Production docs deploy only from main (or manual dispatch on main)
if: |
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
github.ref == 'refs/heads/main'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Deploy production docs from the merged main branch only.
command: pages deploy site --project-name=zenzic --branch=main --commit-dirty=true