@@ -17,12 +17,14 @@ jobs:
1717 strategy :
1818 fail-fast : false
1919 matrix :
20- python-version : ["3.9 "]
20+ python-version : ["3.13 "]
2121
2222 steps :
23- - uses : actions/checkout@v2
23+ - uses : actions/checkout@v4
24+ with :
25+ fetch-depth : 0 # Fetch all history and tags for setuptools_scm
2426 - name : Set up Python ${{ matrix.python-version }}
25- uses : actions/setup-python@v2
27+ uses : actions/setup-python@v5
2628 with :
2729 python-version : ${{ matrix.python-version }}
2830 - name : Install
@@ -35,13 +37,86 @@ jobs:
3537 cd docs
3638 make html
3739 - name : Upload docs
38- uses : actions/upload-artifact@v1
40+ uses : actions/upload-artifact@v4
41+ with :
42+ name : docs
43+ path : docs/_build/html
44+
45+ deploy-dev :
46+ needs : build
47+ runs-on : ubuntu-latest
48+ if : github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'tee-ar-ex/trx-python'
49+ steps :
50+ - uses : actions/checkout@v4
51+ - uses : actions/download-artifact@v4
52+ with :
53+ name : docs
54+ path : docs/_build/html
55+ - name : Publish dev docs to Github Pages
56+ uses : JamesIves/github-pages-deploy-action@v4
57+ with :
58+ branch : gh-pages
59+ folder : docs/_build/html
60+ target-folder : dev
61+
62+ deploy-release :
63+ needs : build
64+ runs-on : ubuntu-latest
65+ if : startsWith(github.ref, 'refs/tags/') && github.repository == 'tee-ar-ex/trx-python'
66+ steps :
67+ - uses : actions/checkout@v4
68+ - uses : actions/download-artifact@v4
3969 with :
4070 name : docs
4171 path : docs/_build/html
42- - name : Publish docs to Github Pages
43- if : startsWith(github.event.ref, 'refs/tags')
72+ - name : Get version from tag
73+ id : get_version
74+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
75+ - name : Fetch existing switcher.json from gh-pages
76+ run : |
77+ curl -sSL https://tee-ar-ex.github.io/trx-python/switcher.json -o switcher.json || echo '[]' > switcher.json
78+ - name : Update switcher.json with new version
79+ run : python tools/update_switcher.py switcher.json --version ${{ steps.get_version.outputs.VERSION }}
80+ - name : Create root files (redirect + switcher.json)
81+ run : |
82+ mkdir -p root_files
83+ cp switcher.json root_files/
84+ cat > root_files/index.html << 'EOF'
85+ <!DOCTYPE html>
86+ <html lang="en">
87+ <head>
88+ <meta charset="utf-8">
89+ <meta name="viewport" content="width=device-width, initial-scale=1">
90+ <title>trx-python - TRX File Format for Tractography</title>
91+ <meta name="description" content="trx-python is a Python implementation of the TRX file format for tractography data, designed for efficient handling of brain fiber tract streamlines.">
92+ <meta name="robots" content="index, follow">
93+ <link rel="canonical" href="https://tee-ar-ex.github.io/trx-python/stable/">
94+ <meta http-equiv="refresh" content="0; URL=https://tee-ar-ex.github.io/trx-python/stable/">
95+ <script>window.location.replace("https://tee-ar-ex.github.io/trx-python/stable/");</script>
96+ </head>
97+ <body>
98+ <h1>trx-python Documentation</h1>
99+ <p>Python implementation of the TRX file format for tractography data.</p>
100+ <p>If you are not redirected automatically, visit the <a href="https://tee-ar-ex.github.io/trx-python/stable/">stable documentation</a>.</p>
101+ </body>
102+ </html>
103+ EOF
104+ - name : Publish root files (redirect + switcher.json)
105+ uses : JamesIves/github-pages-deploy-action@v4
106+ with :
107+ branch : gh-pages
108+ folder : root_files
109+ target-folder : .
110+ clean : false
111+ - name : Publish release docs to Github Pages
112+ uses : JamesIves/github-pages-deploy-action@v4
113+ with :
114+ branch : gh-pages
115+ folder : docs/_build/html
116+ target-folder : ${{ steps.get_version.outputs.VERSION }}
117+ - name : Publish stable docs to Github Pages
44118 uses : JamesIves/github-pages-deploy-action@v4
45119 with :
46120 branch : gh-pages
47121 folder : docs/_build/html
122+ target-folder : stable
0 commit comments