|
| 1 | +name: Build & Publish to GH Pages |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'publish*' |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + actions: read |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: "pages" |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + publish: |
| 19 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 20 | + runs-on: ubuntu-latest |
| 21 | + environment: |
| 22 | + name: github-pages |
| 23 | + url: ${{ steps.deployment.outputs.page_url }} |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + - name: Setup Anaconda |
| 28 | + uses: conda-incubator/setup-miniconda@v3 |
| 29 | + with: |
| 30 | + auto-update-conda: true |
| 31 | + auto-activate-base: true |
| 32 | + miniconda-version: 'latest' |
| 33 | + python-version: "3.13" |
| 34 | + environment-file: environment.yml |
| 35 | + activate-environment: quantecon |
| 36 | + - name: Install JAX (CPU) |
| 37 | + shell: bash -l {0} |
| 38 | + run: | |
| 39 | + pip install jax |
| 40 | + - name: Display Conda Environment Versions |
| 41 | + shell: bash -l {0} |
| 42 | + run: conda list |
| 43 | + - name: Display Pip Versions |
| 44 | + shell: bash -l {0} |
| 45 | + run: pip list |
| 46 | + # Download Build Cache from cache.yml |
| 47 | + - name: Download "build" folder (cache) |
| 48 | + uses: dawidd6/action-download-artifact@v6 |
| 49 | + with: |
| 50 | + workflow: cache.yml |
| 51 | + branch: main |
| 52 | + name: build-cache |
| 53 | + path: _build |
| 54 | + # Build Assets (Download Notebooks) |
| 55 | + - name: Build Download Notebooks (sphinx-tojupyter) |
| 56 | + shell: bash -l {0} |
| 57 | + run: | |
| 58 | + jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going |
| 59 | + mkdir -p _build/html/_notebooks |
| 60 | + cp -u _build/jupyter/*.ipynb _build/html/_notebooks |
| 61 | + # Final Build of HTML (with assets) |
| 62 | + - name: Build HTML |
| 63 | + shell: bash -l {0} |
| 64 | + run: | |
| 65 | + jb build lectures --path-output ./ -n -W --keep-going |
| 66 | + - name: Upload Execution Reports |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + if: failure() |
| 69 | + with: |
| 70 | + name: execution-reports |
| 71 | + path: _build/html/reports |
| 72 | + - name: Setup Pages |
| 73 | + uses: actions/configure-pages@v4 |
| 74 | + - name: Upload Pages artifact |
| 75 | + uses: actions/upload-pages-artifact@v3 |
| 76 | + with: |
| 77 | + path: _build/html/ |
| 78 | + - name: Deploy to GitHub Pages |
| 79 | + id: deployment |
| 80 | + uses: actions/deploy-pages@v4 |
0 commit comments