Sync source from private repo #169
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 Jupyter Book | |
| on: | |
| push: | |
| branches: [ main ] | |
| permissions: | |
| contents: write # needed for pushing to gh-pages | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source (public repo main) | |
| uses: actions/checkout@v4 | |
| # Cache the downloaded Conda packages (safe & effective) | |
| - name: Cache conda packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: /home/runner/conda_pkgs_dir | |
| key: ${{ runner.os }}-conda-pkgs-${{ hashFiles('environment_JB.yml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-conda-pkgs- | |
| # # Installing texlive | |
| # - name: Install LaTeX toolchain for Matplotlib | |
| # run: | | |
| # sudo apt-get update | |
| # sudo apt-get install -y --no-install-recommends \ | |
| # texlive-latex-base texlive-latex-recommended texlive-latex-extra \ | |
| # texlive-fonts-recommended texlive-fonts-extra \ | |
| # cm-super dvipng dvisvgm ghostscript | |
| # Set up Conda from environment.yml (commit this file to the public repo) | |
| - name: Set up Conda | |
| uses: conda-incubator/setup-miniconda@v2 | |
| with: | |
| miniconda-version: latest | |
| auto-update-conda: true | |
| use-mamba: true | |
| environment-file: environment_JB.yml # or environment_JB.yml | |
| activate-environment: 2025-book-env # must match the env name below | |
| # OPTIONAL: register a kernel if you execute notebooks during build | |
| # (Requires 'ipykernel' in your environment.yml dependencies) | |
| - name: Register Jupyter kernel | |
| run: | | |
| conda run -n 2025-book-env python -m ipykernel install \ | |
| --sys-prefix \ | |
| --name 2025-book-env \ | |
| --display-name "Python (2025-book-env)" | |
| # Build the book | |
| - name: Build book | |
| run: conda run -n 2025-book-env jupyter-book build . | |
| # Publish the built HTML in _build/html to gh-pages of THIS repo | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} # same-repo push | |
| publish_dir: ./_build/html | |
| publish_branch: gh-pages | |
| keep_files: true |