Skip to content

docs(sphinx): optimize content, add language switcher #14

docs(sphinx): optimize content, add language switcher

docs(sphinx): optimize content, add language switcher #14

Workflow file for this run

name: Docs
on:
push:
branches: [main]
paths:
- "docs/sphinx/**"
- "docs/README.md"
- "src/unilab/**"
- "scripts/generate_support_matrix.py"
- "conf/**"
- "README.md"
- "CONTRIBUTING.md"
- "AGENTS.md"
- "CLAUDE.md"
- ".github/workflows/docs.yml"
pull_request:
branches: [main]
paths:
- "docs/sphinx/**"
- "docs/README.md"
- "src/unilab/**"
- "scripts/generate_support_matrix.py"
- "conf/**"
- "README.md"
- "CONTRIBUTING.md"
- "AGENTS.md"
- "CLAUDE.md"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build Sphinx
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgl1 libegl1 libosmesa6 libglfw3 \
ffmpeg
- name: Install doc deps
run: |
python -m pip install --upgrade pip
pip install -r docs/sphinx/requirements.txt
- name: Install UniLab (autodoc target)
id: install_unilab
continue-on-error: true
# We skip extras (motrix, mlx) — autodoc_mock_imports in conf.py
# covers heavy deps. If install fails we still build prose-only.
run: pip install -e .
- name: Configure prose-only fallback
if: steps.install_unilab.outcome != 'success'
run: |
echo "::warning::UniLab install failed — building prose-only docs"
echo "UNILAB_DOCS_SKIP_AUTODOC=1" >> "$GITHUB_ENV"
- name: Build HTML
working-directory: docs/sphinx
run: sphinx-build -b html -n source build/html
- name: Build linkcheck (non-blocking)
continue-on-error: true
working-directory: docs/sphinx
run: sphinx-build -b linkcheck source build/linkcheck
- name: Upload built site
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/sphinx/build/html
retention-days: 7
deploy:
name: Deploy to UniLab-doc gh-pages
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Download built site
uses: actions/download-artifact@v4
with:
name: docs-html
path: site
- name: Push to UniLab-doc gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
# SSH deploy key for unilabsim/UniLab-doc (write access required).
# Add it once in this repo's Secrets as UNILAB_DOC_DEPLOY_KEY.
deploy_key: ${{ secrets.UNILAB_DOC_DEPLOY_KEY }}
external_repository: unilabsim/UniLab-doc
publish_branch: gh-pages
publish_dir: ./site
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
commit_message: "docs: deploy from UniLab@${{ github.sha }}"
full_commit_message: |
docs: deploy from UniLab@${{ github.sha }}
Source: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}