-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (83 loc) · 2.57 KB
/
docs.yml
File metadata and controls
97 lines (83 loc) · 2.57 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
name: Deploy Documentation
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'docs_fragments/**'
- 'zensical.toml'
- 'pyproject.toml'
- 'uv.lock'
- 'src/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
PAGES_ADMIN_TOKEN: ${{ secrets.PAGES_ADMIN_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Check GitHub Pages status
id: pages-status
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh api "repos/${GITHUB_REPOSITORY}/pages" >/dev/null 2>&1; then
echo "enabled=true" >> "${GITHUB_OUTPUT}"
else
echo "enabled=false" >> "${GITHUB_OUTPUT}"
fi
- name: Enable and configure GitHub Pages
if: ${{ steps.pages-status.outputs.enabled == 'false' && env.PAGES_ADMIN_TOKEN != '' }}
uses: actions/configure-pages@v6.0.0
with:
token: ${{ env.PAGES_ADMIN_TOKEN }}
enablement: true
- name: Configure GitHub Pages
if: ${{ steps.pages-status.outputs.enabled == 'true' }}
uses: actions/configure-pages@v6.0.0
- name: Explain missing GitHub Pages setup
if: ${{ steps.pages-status.outputs.enabled == 'false' && env.PAGES_ADMIN_TOKEN == '' }}
run: |
echo "GitHub Pages is not enabled for this repository." >&2
echo "Enable it in Settings > Pages > Build and deployment > Source > GitHub Actions." >&2
echo "Alternatively, add a PAGES_ADMIN_TOKEN repository secret with Pages write and Administration write permissions." >&2
exit 1
- name: Install dependencies
run: uv sync --group dev --frozen
- name: Build site
run: rm -rf site && uv run zensical build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: site
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5