-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (80 loc) · 2.93 KB
/
Copy pathdocs.yaml
File metadata and controls
94 lines (80 loc) · 2.93 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
name: Docs
on:
push:
branches: [ main ]
paths:
- 'docsite/**'
- '.github/workflows/docs.yaml'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [ main ]
permissions:
contents: read
concurrency:
group: ${{ github.event_name == 'pull_request' && format('docs-pr-{0}', github.event.pull_request.number) || 'pages' }}
cancel-in-progress: true
jobs:
build:
name: docs
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
defaults:
run:
working-directory: docsite
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
# No paths: filter on the pull_request trigger (unlike push, above) so this
# job always runs and can be a required status check without permanently
# blocking merge on PRs that never touch docsite/ — see relevant-changes gate below.
- name: Check for relevant changes
id: changes
if: github.event_name == 'pull_request'
run: |
if git diff --name-only "origin/${{ github.event.pull_request.base.ref }}...HEAD" | grep -qE '^(docsite/|\.github/workflows/docs\.yaml)'; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"
fi
- name: Install pngquant
if: github.event_name != 'pull_request' || steps.changes.outputs.relevant == 'true'
run: sudo apt-get update && sudo apt-get install -y pngquant
- name: Setup Python
if: github.event_name != 'pull_request' || steps.changes.outputs.relevant == 'true'
uses: actions/setup-python@v6.3.0
with:
python-version-file: "docsite/pyproject.toml"
- name: Install uv
if: github.event_name != 'pull_request' || steps.changes.outputs.relevant == 'true'
uses: astral-sh/setup-uv@v8.3.2
with:
enable-cache: true
- name: Install the project
if: github.event_name != 'pull_request' || steps.changes.outputs.relevant == 'true'
run: uv sync --locked --all-extras --dev
- name: Build documentation
if: github.event_name != 'pull_request' || steps.changes.outputs.relevant == 'true'
run: uv run zensical build -f zensical.toml --clean
- name: Upload artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v5
with:
path: docsite/site
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5