Skip to content

Merge pull request #103 from skoudoro/fix-local-header #268

Merge pull request #103 from skoudoro/fix-local-header

Merge pull request #103 from skoudoro/fix-local-header #268

Workflow file for this run

name: Documentation build
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history and tags for setuptools_scm
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install cython
python -m pip install --upgrade pip
pip install .[doc]
- name: Build docs
run: |
cd docs
SPHINXOPTS="-W" make html
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/html
deploy-dev:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'tee-ar-ex/trx-python'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: docs
path: docs/_build/html
- name: Publish dev docs to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html
target-folder: dev
deploy-release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'tee-ar-ex/trx-python'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: docs
path: docs/_build/html
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Fetch existing switcher.json from gh-pages
run: |
curl -sSL https://tee-ar-ex.github.io/trx-python/switcher.json -o switcher.json || echo '[]' > switcher.json
- name: Update switcher.json with new version
run: python tools/update_switcher.py switcher.json --version ${{ steps.get_version.outputs.VERSION }}
- name: Create root files (redirect + switcher.json)
run: |
mkdir -p root_files
cp switcher.json root_files/
cat > root_files/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>trx-python - TRX File Format for Tractography</title>
<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.">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://tee-ar-ex.github.io/trx-python/stable/">
<meta http-equiv="refresh" content="0; URL=https://tee-ar-ex.github.io/trx-python/stable/">
<script>window.location.replace("https://tee-ar-ex.github.io/trx-python/stable/");</script>
</head>
<body>
<h1>trx-python Documentation</h1>
<p>Python implementation of the TRX file format for tractography data.</p>
<p>If you are not redirected automatically, visit the <a href="https://tee-ar-ex.github.io/trx-python/stable/">stable documentation</a>.</p>
</body>
</html>
EOF
- name: Publish root files (redirect + switcher.json)
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: root_files
target-folder: .
clean: false
- name: Publish release docs to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html
target-folder: ${{ steps.get_version.outputs.VERSION }}
- name: Publish stable docs to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html
target-folder: stable