Updated dependencies with imagemagick #122
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
# Modified from: https://github.com/choldgraf/deploy_configurations/blob/master/.github/workflows/main.yml | |
# Note: lint with https://rhysd.github.io/actionlint/ | |
name: Publish JupyterBook to GitHub Pages | |
on: | |
push: # trigger build only when push to master | |
branches: | |
- main | |
- test-gh-actions # GH actions test branch | |
permissions: | |
id-token: write | |
pages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.10.15 | |
- name: Install Python dependencies | |
run: | | |
sudo apt-get install python3-pip | |
pip install numpy | |
pip install sympy | |
pip install matplotlib | |
pip install jupyter-book | |
pip install ghp-import | |
PATH="${PATH}:${HOME}/.local/bin" | |
- name: Build book HTML | |
run: | | |
jupyter-book build ./book | |
- name: Push built book HTML as artifact | |
uses: actions/upload-pages-artifact@v33eq | |
with: | |
path: "book/_build/html" | |
- name: Deploy book HTML to Github Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
- name: Build PDF of book | |
run: | | |
sudo apt-get update | |
# TeX tools | |
sudo apt-get install texlive-latex-extra \ | |
texlive-fonts-extra \ | |
texlive-xetex latexmk | |
# Image tools | |
sudo apt install libpng-dev libjpeg-dev libtiff-dev imagemagick | |
# Build actual book | |
jupyter-book build book --builder pdflatex | |
mv book/_build/latex/python.pdf book/_build/elara-handbook.pdf | |
- name: Upload book PDF to Github releases | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
pip install github-release-retry | |
github-release-retry \ | |
--user elaraproject \ | |
--repo elara-handbook \ | |
--tag_name v0.0.0-$(git rev-parse HEAD | cut -c 1-8) \ | |
--prerelease \ | |
--body_string "Automatically generated from book sources via Github Actions" \ | |
book/_build/elara-handbook.pdf |