Skip to content

Fix docstring typos in PADMM types (#2253) #24

Fix docstring typos in PADMM types (#2253)

Fix docstring typos in PADMM types (#2253) #24

Workflow file for this run

name: Deploy dev documentation
on:
push:
branches:
- main
workflow_dispatch:
# Ensure only one deployment runs at a time
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0 # Need full history for gh-pages branch
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
version: "0.11.0"
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: ".python-version"
- name: Install pandoc
uses: pandoc/actions/setup@86321b6dd4675f5014c611e05088e10d4939e09e # v1.1.1
- name: Build Sphinx documentation
run: uv run --extra docs --extra sim sphinx-build -j auto -b html docs docs/_build/html
env:
NEWTON_REQUIRE_PANDOC: "1"
- name: Deploy to gh-pages /latest/
run: |
set -e # Exit on any error
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
# Save built docs and 404 template outside the repo before switching branches
mv docs/_build/html /tmp/docs-latest
cp docs/_static/gh-pages-404.html /tmp/gh-pages-404.html
# Switch to gh-pages branch (check existence first to avoid masking other fetch errors)
if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then
git fetch origin gh-pages:gh-pages
git checkout gh-pages
else
echo "Creating new gh-pages branch"
git checkout --orphan gh-pages
git rm -rf . || true
fi
# Remove old /latest/ and replace with new build
rm -rf latest
mv /tmp/docs-latest latest
# Deploy custom 404 page for redirecting old non-versioned URLs
cp /tmp/gh-pages-404.html 404.html
# Ensure .nojekyll exists
touch .nojekyll
# Check gh-pages size (warn if approaching GitHub Pages 1GB limit)
SIZE_KB=$(du -sk --exclude=.git . | cut -f1)
SIZE_MB=$((SIZE_KB / 1024))
echo "Current gh-pages size: ${SIZE_MB}MB"
if [ "$SIZE_MB" -gt 800 ]; then
echo "::warning::gh-pages branch is ${SIZE_MB}MB, approaching GitHub Pages 1GB limit. Consider pruning old versions."
fi
# Stage only the files we want deployed (avoid committing build artifacts
# like .venv/ that persist after switching branches)
git add latest 404.html .nojekyll
git diff --cached --quiet || git commit -m "Update dev docs from main@${GITHUB_SHA::8}"
git push origin gh-pages