update #17
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: Build & Publish to GH Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Anaconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| auto-activate-base: true | |
| miniconda-version: 'latest' | |
| python-version: "3.13" | |
| environment-file: environment.yml | |
| activate-environment: quantecon_scipy_tutorial_2026 | |
| - name: Install JAX | |
| shell: bash -l {0} | |
| run: | | |
| pip install -U jax | |
| python scripts/test-jax-install.py | |
| - name: Display Conda Environment Versions | |
| shell: bash -l {0} | |
| run: conda list | |
| - name: Display Pip Versions | |
| shell: bash -l {0} | |
| run: pip list | |
| # Build Download Notebooks first (so HTML theme detects them) | |
| - name: Build Download Notebooks (sphinx-tojupyter) | |
| shell: bash -l {0} | |
| run: | | |
| jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going | |
| - name: Copy notebooks for download and Colab support | |
| shell: bash -l {0} | |
| run: | | |
| # Copy to _build/html/_notebooks for download button | |
| mkdir -p _build/html/_notebooks | |
| cp _build/jupyter/*.ipynb _build/html/_notebooks/ 2>/dev/null || true | |
| echo "Notebooks copied to _build/html/_notebooks/ for download:" | |
| ls -la _build/html/_notebooks/ | |
| # Copy to notebooks/ folder in repo for Colab | |
| mkdir -p notebooks | |
| cp _build/jupyter/*.ipynb notebooks/ 2>/dev/null || true | |
| echo "Notebooks copied to notebooks/ folder for Colab:" | |
| ls -la notebooks/ | |
| # Build HTML (after notebooks so theme can detect them) | |
| - name: Build HTML | |
| shell: bash -l {0} | |
| run: | | |
| jb build lectures --path-output ./ -n -W --keep-going | |
| - name: Commit notebooks to repo | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add notebooks/ | |
| if ! git diff --staged --quiet; then | |
| git commit -m "Update notebooks for Colab [skip ci]" | |
| git pull --rebase origin main | |
| git push origin main | |
| fi | |
| - name: Upload Execution Reports | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: execution-reports | |
| path: _build/html/reports | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: _build/html/ | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |