Repository navigation
61 lines (56 loc) · 1.83 KB
/
Copy pathdocs.yml
File metadata and controls
61 lines (56 loc) · 1.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
name: docs
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: docs-pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
enable-cache: false
- name: Configure Google Analytics
# The measurement ID comes from the RUSTGIS_GA_MEASUREMENT_ID repository variable. Unset
# (forks, local builds, PR previews) ships no tracker; a value that is not a GA4 measurement
# ID fails the build instead of publishing a tag that reports nowhere.
env:
RAW_MEASUREMENT_ID: ${{ vars.RUSTGIS_GA_MEASUREMENT_ID }}
run: |
set -euo pipefail
id=$(printf '%s' "${RAW_MEASUREMENT_ID:-}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr '[:lower:]' '[:upper:]')
if [ -z "$id" ]; then
echo "Analytics disabled (no measurement ID configured)."
exit 0
fi
if [[ ! $id =~ ^G-[A-Z0-9]{4,24}$ ]]; then
echo "::error::RUSTGIS_GA_MEASUREMENT_ID is not a GA4 measurement ID (G-...)."
exit 1
fi
printf '\n[project.extra.analytics]\nprovider = "google"\nproperty = "%s"\n' "$id" >> zensical.toml
echo "Analytics enabled for $id."
- name: Build docs with Zensical
run: |
uv venv --python 3.12
uv pip install -r requirements_docs.txt
.venv/bin/zensical build
- uses: actions/upload-pages-artifact@v5
with:
path: ./site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5