update #91
This file contains 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: deploy-book | |
# Only run this when the master branch changes | |
on: | |
push: | |
branches: | |
- main | |
# This job installs dependencies, build the book, and pushes it to `gh-pages` | |
jobs: | |
deploy-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Install dependencies | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
use-mamba: true | |
channels: conda-forge | |
activate-environment: phys139 | |
environment-file: notebooks/environment.yml | |
python-version: 3.10.10 | |
auto-activate-base: false | |
# Check dependencies | |
- name: Check Miniconda | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
- name: Build the book | |
shell: bash -l {0} | |
run: | | |
jupyter contrib nbextension install --user | |
jupyter nbextension enable --py widgetsnbextension | |
jupyter-book build notebooks | |
- name: Compile LaTeX | |
uses: docker://xucheng/texlive-full:latest | |
with: | |
entrypoint: /bin/sh | |
args: | | |
-c "\ | |
cd syllabus && \ | |
latexmk && \ | |
cd ../homeworks/homework_1 && \ | |
pdflatex homework_1 && \ | |
cd ../homework_2 && \ | |
pdflatex homework_2 && \ | |
cd ../homework_3 && \ | |
pdflatex homework_3 && \ | |
cd ../homework_4 && \ | |
pdflatex homework_4" | |
- name: Copy syllabus and homework for deployment | |
run: | | |
cp syllabus/syllabus.pdf notebooks/_build/html/syllabus.pdf && \ | |
cp homeworks/homework_1/homework_1.pdf notebooks/_build/html/homework_1.pdf && \ | |
cp homeworks/homework_2/homework_2.pdf notebooks/_build/html/homework_2.pdf && \ | |
cp homeworks/homework_3/homework_3.pdf notebooks/_build/html/homework_3.pdf && \ | |
cp homeworks/homework_4/homework_4.pdf notebooks/_build/html/homework_4.pdf | |
- name: GitHub Pages action | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: notebooks/_build/html | |
force_orphan: true | |
user_name: "github-actions[bot]" | |
user_email: "github-actions[bot]@users.noreply.github.com" |