@@ -14,15 +14,12 @@ jobs:
14
14
steps :
15
15
- uses : actions/checkout@v4
16
16
with :
17
- fetch-depth : 0 # Fetch all history for proper versioning
18
-
17
+ fetch-depth : 0
19
18
- uses : actions/setup-python@v5
20
19
with :
21
- python-version : " 3.13"
22
-
20
+ python-version : " 3.11"
23
21
- name : Install dependencies
24
22
run : pip install -e ".[dev]"
25
-
26
23
- name : Determine version and build type
27
24
id : version
28
25
run : |
@@ -35,14 +32,12 @@ jobs:
35
32
echo "DIR=latest" >> $GITHUB_OUTPUT
36
33
echo "TAG=main" >> $GITHUB_OUTPUT
37
34
else
38
- echo "VERSION=latest " >> $GITHUB_OUTPUT
39
- echo "DIR=latest " >> $GITHUB_OUTPUT
35
+ echo "VERSION=preview " >> $GITHUB_OUTPUT
36
+ echo "DIR=preview-${{ github.event.pull_request.number }} " >> $GITHUB_OUTPUT
40
37
echo "TAG=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
41
38
fi
42
-
43
39
- name : Generate versions.json
44
40
run : |
45
- # Create a more comprehensive versions.json
46
41
cat <<EOF > docs/versions.json
47
42
[
48
43
{
@@ -57,23 +52,17 @@ jobs:
57
52
}
58
53
]
59
54
EOF
60
-
61
- - name : Build docs
55
+ - name : Build documentation
56
+ env :
57
+ DOCS_VERSION : ${{ steps.version.outputs.VERSION }}
62
58
run : |
63
- # Set DOCS_VERSION env var according to determined version
64
- export DOCS_VERSION=${{ steps.version.outputs.VERSION }}
65
- echo "Building documentation for version: $DOCS_VERSION"
66
-
67
- # Build the documentation
68
- python -m sphinx -b html docs docs/_build
69
-
70
- - name : Copy versions.json to build output
71
- run : cp docs/versions.json docs/_build/
72
-
59
+ python -m sphinx -b html docs docs/_build/${{ steps.version.outputs.DIR }}
60
+ - name : Copy versions.json
61
+ run : cp docs/versions.json docs/_build/${{ steps.version.outputs.DIR }}/
73
62
- name : Create redirect index.html
74
63
if : ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
75
64
run : |
76
- # Create a root index.html that redirects to the stable version (or latest if no stable exists)
65
+ mkdir -p docs/_build
77
66
cat <<EOF > docs/_build/index.html
78
67
<!DOCTYPE html>
79
68
<html>
87
76
</body>
88
77
</html>
89
78
EOF
90
-
91
- - name : Deploy docs
79
+ - name : Deploy to GitHub Pages
92
80
uses : peaceiris/actions-gh-pages@v3
93
81
with :
94
82
github_token : ${{ secrets.GITHUB_TOKEN }}
95
83
publish_dir : ./docs/_build
96
- destination_dir : ${{ steps.version.outputs.DIR }}
84
+ destination_dir : .
0 commit comments