|
1 | | -# https://jupyterbook.org/en/stable/publish/gh-pages.html |
2 | | - |
3 | | -name: Deploy to GitHub Pages |
| 1 | +name: deploy-book |
4 | 2 |
|
| 3 | +# Run this when the master or main branch changes |
5 | 4 | on: |
6 | 5 | push: |
7 | 6 | branches: |
8 | | - - main |
| 7 | + - master |
| 8 | + - main |
| 9 | + # If your git repository has the Jupyter Book within some-subfolder next to |
| 10 | + # unrelated files, you can make this run only if a file within that specific |
| 11 | + # folder has been modified. |
| 12 | + # |
| 13 | + # paths: |
| 14 | + # - some-subfolder/** |
9 | 15 |
|
| 16 | +# This job installs dependencies, builds the book, and pushes it to `gh-pages` |
10 | 17 | jobs: |
11 | 18 | deploy-book: |
12 | 19 | runs-on: ubuntu-latest |
13 | 20 | permissions: |
14 | 21 | pages: write |
15 | 22 | id-token: write |
16 | 23 | steps: |
17 | | - - uses: actions/checkout@v5 |
18 | | - |
19 | | - - name: Set up Python |
20 | | - uses: actions/setup-python@v6 |
21 | | - with: |
22 | | - python-version: "3.14" |
23 | | - cache: pip |
24 | | - - run: pip install -r requirements.txt |
25 | | - |
26 | | - - name: Build the book |
27 | | - run: | |
28 | | - jupyter-book build . |
29 | | -
|
30 | | - - name: Upload artifact |
31 | | - uses: actions/upload-pages-artifact@v4 |
32 | | - with: |
33 | | - path: _build/html |
34 | | - |
35 | | - - name: Deploy to GitHub Pages |
36 | | - id: deployment |
37 | | - uses: actions/deploy-pages@v4 |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + # Install dependencies |
| 27 | + - name: Set up Python 3.11 |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: '3.11' |
| 31 | + cache: pip # Implicitly uses requirements.txt for cache key |
| 32 | + |
| 33 | + - name: Install dependencies |
| 34 | + run: pip install -r requirements.txt |
| 35 | + |
| 36 | + # (optional) Cache your executed notebooks between runs |
| 37 | + # if you have config: |
| 38 | + # execute: |
| 39 | + # execute_notebooks: cache |
| 40 | + - name: cache executed notebooks |
| 41 | + uses: actions/cache@v4 |
| 42 | + with: |
| 43 | + path: _build/.jupyter_cache |
| 44 | + key: jupyter-book-cache-${{ hashFiles('requirements.txt') }} |
| 45 | + |
| 46 | + # Build the book |
| 47 | + - name: Build the book |
| 48 | + run: | |
| 49 | + jupyter-book build . |
| 50 | +
|
| 51 | + # Upload the book's HTML as an artifact |
| 52 | + - name: Upload artifact |
| 53 | + uses: actions/upload-pages-artifact@v3 |
| 54 | + with: |
| 55 | + path: "_build/html" |
| 56 | + |
| 57 | + # Deploy the book's HTML to GitHub Pages |
| 58 | + - name: Deploy to GitHub Pages |
| 59 | + id: deployment |
| 60 | + uses: actions/deploy-pages@v4 |
0 commit comments