Update environment.yml #49
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: Build Project Files | |
on: | |
push: | |
paths: | |
- .github/workflows/build_project.yml | |
- project/** | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./project | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Make build directory | |
run: mkdir build | |
- name: Copy files | |
run: | | |
cp ../.pre-commit-config.yaml \ | |
../.ruff.toml \ | |
../.isort.cfg \ | |
requirements.txt \ | |
cells.py \ | |
obstacles.py \ | |
build/ | |
- name: Install nbconvert | |
run: pip install nbconvert | |
- name: Render slides | |
run: | | |
jupyter nbconvert slides.ipynb --to slides --embed-images | |
rm slides.ipynb | |
mv slides.slides.html build/slides.html | |
- name: Process notebooks | |
run: | | |
find -iname '*.ipynb' -printf '%P\n' | xargs -I {} jupyter nbconvert --clear-output --inplace "{}" | |
find -iname '*.ipynb' -printf '%P\n' | xargs -I {} python process.py "{}" "build/{}" | |
- name: Convert README to PDF | |
uses: docker://pandoc/latex:2.9 | |
with: | |
entrypoint: /bin/sh | |
args: >- | |
-c " | |
cd project && | |
tlmgr update --self && | |
tlmgr install framed tcolorbox environ trimspaces listingsutf8 && | |
pandoc | |
--pdf-engine=xelatex | |
--highlight-style kate | |
-N | |
-V colorlinks -V urlcolor=NavyBlue | |
-V geometry:'top=2cm, bottom=1.5cm, left=2cm, right=2cm' | |
-H head.tex | |
--output=build/README.pdf | |
README.md" | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: project-files | |
path: project/build | |
- name: Install mamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: 1.5.1-0 | |
environment-file: project/build-environment.yml | |
cache-environment: true | |
- name: Build the JupyterLite site | |
shell: bash -l {0} | |
run: | | |
mkdir content | |
jupyter lite build --contents build --output-dir dist | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: project/dist | |
deploy: | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |