-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 1.63 KB
/
Copy pathpages.yaml
File metadata and controls
61 lines (53 loc) · 1.63 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: Generate Documentation and Publish to Pages
on:
push:
branches:
- main
tags:
- 'v**'
jobs:
pages:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Sphinx Python Dependencies
run: pip install -r requirements.txt
working-directory: Documentation
- name: Build Versioned Documentation
run: sphinx-multiversion . _build/html
working-directory: Documentation
- name: Create redirect to latest version
run: |
LATEST_TAG=$(git tag -l 'v*' --sort=-version:refname | head -n1)
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="main"
fi
cat > Documentation/_build/html/index.html <<EOF
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=./${LATEST_TAG}/" />
</head>
<body>
<p>Redirecting to <a href="./${LATEST_TAG}/">latest documentation</a>...</p>
</body>
</html>
EOF
- name: Add .nojekyll file
run: touch Documentation/_build/html/.nojekyll
- name: Deploy Documentation to Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./Documentation/_build/html
publish_branch: gh-pages