Fix notebook URLs. Ensure that zip files are built on every push. #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docs and Pages | |
| on: | |
| push: | |
| branches: [main, cleanup] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-site: | |
| name: build docs and jupyterlite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[dev,docs] | |
| pip install build | |
| pip install jupyterlite jupyter-server jupyterlite-pyodide-kernel | |
| sudo apt-get update | |
| sudo apt-get install -y graphviz | |
| - name: Build local bdsim wheel for JupyterLite | |
| run: | | |
| cd docs/lite | |
| rm -f pypi/*.whl pypi/all.json | |
| python -m build --wheel --outdir pypi ../.. | |
| python gen_index.py | |
| echo "Using piplite index:" | |
| cat pypi/all.json | |
| - name: Build Sphinx docs | |
| run: | | |
| make -C docs html | |
| - name: Prepare notebooks for JupyterLite | |
| run: | | |
| mkdir -p docs/lite/files | |
| find docs/lite/files -name '*.ipynb' -delete | |
| cp docs/notebooks/*.ipynb docs/lite/files/ | |
| - name: Build JupyterLite content | |
| run: | | |
| cd docs/lite | |
| jupyter lite build --output-dir ../build/html/lite --contents files --force | |
| - name: Validate JupyterLite kernel availability | |
| run: | | |
| if ! find docs/build/html/lite -type d -iname '*pyodide*kernel*' | grep -q .; then | |
| echo "ERROR: JupyterLite build does not include a Pyodide kernel extension." | |
| echo "Expected a directory matching '*pyodide*kernel*' under docs/build/html/lite." | |
| exit 1 | |
| fi | |
| - name: Prepare Pages artifact | |
| run: | | |
| touch docs/build/html/.nojekyll | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: docs/build/html | |
| deploy: | |
| name: deploy to github pages | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/cleanup' | |
| needs: build-site | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |