@@ -14,15 +14,12 @@ jobs:
1414 steps :
1515 - uses : actions/checkout@v4
1616 with :
17- fetch-depth : 0 # Fetch all history for proper versioning
18-
17+ fetch-depth : 0
1918 - uses : actions/setup-python@v5
2019 with :
21- python-version : " 3.13"
22-
20+ python-version : " 3.11"
2321 - name : Install dependencies
2422 run : pip install -e ".[dev]"
25-
2623 - name : Determine version and build type
2724 id : version
2825 run : |
@@ -35,14 +32,12 @@ jobs:
3532 echo "DIR=latest" >> $GITHUB_OUTPUT
3633 echo "TAG=main" >> $GITHUB_OUTPUT
3734 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
4037 echo "TAG=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
4138 fi
42-
4339 - name : Generate versions.json
4440 run : |
45- # Create a more comprehensive versions.json
4641 cat <<EOF > docs/versions.json
4742 [
4843 {
@@ -57,23 +52,17 @@ jobs:
5752 }
5853 ]
5954 EOF
60-
61- - name : Build docs
55+ - name : Build documentation
56+ env :
57+ DOCS_VERSION : ${{ steps.version.outputs.VERSION }}
6258 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 }}/
7362 - name : Create redirect index.html
7463 if : ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
7564 run : |
76- # Create a root index.html that redirects to the stable version (or latest if no stable exists)
65+ mkdir -p docs/_build
7766 cat <<EOF > docs/_build/index.html
7867 <!DOCTYPE html>
7968 <html>
8776 </body>
8877 </html>
8978 EOF
90-
91- - name : Deploy docs
79+ - name : Deploy to GitHub Pages
9280 uses : peaceiris/actions-gh-pages@v3
9381 with :
9482 github_token : ${{ secrets.GITHUB_TOKEN }}
9583 publish_dir : ./docs/_build
96- destination_dir : ${{ steps.version.outputs.DIR }}
84+ destination_dir : .
0 commit comments