-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.32 KB
/
Copy pathdocs.yml
File metadata and controls
84 lines (71 loc) · 2.32 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
name: Docs
on:
push:
branches: [main]
tags: ['v*.*.*']
workflow_dispatch:
concurrency:
group: docs-${{ github.ref }}
# Pages deploys should run to completion; cancelling mid-flight can leave
# the site in a partial state. Match GitHub's own Pages starter template.
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v8.3.1
- name: Install dependencies
run: uv sync --group docs --extra all-cpu
- name: Ensure local main ref exists
# sphinx-polyversion 2.0 enumerates only local refs; on tag-push or
# workflow_dispatch triggers HEAD may be detached without a local main.
# On push-to-main triggers HEAD is already on `main`, in which case
# creating it again would fail ("cannot force update the branch used
# by worktree"), so guard with a presence check.
run: |
git show-ref --verify --quiet refs/heads/main \
|| git branch main origin/main
- name: Build all versions
run: uv run sphinx-polyversion docs/poly.py
- name: Generate versions.json
run: |
uv run python tools/gen_versions_json.py \
docs/_build/html https://davorrunje.github.io/mononet
- name: Write root index.html redirecting to /main/
run: |
cat > docs/_build/html/index.html <<'EOF'
<!doctype html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./main/">
<link rel="canonical" href="./main/">
EOF
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/_build/html
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure Pages
uses: actions/configure-pages@v6
with:
enablement: true
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5