Repository navigation
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 and Publish to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build-pdf: | |
| runs-on: ubuntu-latest | |
| container: pandoc/latex:latest-ubuntu # pandoc + LuaLaTeX pre-installed | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install missing TeX Live packages | |
| run: | | |
| tlmgr option repository https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/tlnet-final | |
| tlmgr install catchfile extsizes moresize mathtools svg transparent | |
| - name: Install inkscape | |
| run: apt-get update && apt-get install -y inkscape xvfb | |
| - name: Build Beamer PDF | |
| run: | | |
| # in=slides | |
| # pandoc -s --toc --toc-depth=1 -t beamer ${in}.md \ | |
| # --pdf-engine=lualatex \ | |
| # --pdf-engine-opt=-shell-escape \ | |
| # --template=templates/daresbury.beamer \ | |
| # --syntax-highlighting=breezedark \ | |
| # --variable tocdepth=1 \ | |
| # -o ${in}.tex | |
| # sed -i "s;includegraphics\[;includegraphics\[keepaspectratio,;g" ${in}.tex | |
| # xvfb-run lualatex -shell-escape ${in}.tex | |
| # xvfb-run lualatex -shell-escape ${in}.tex | |
| # xvfb-run lualatex -shell-escape ${in}.tex | |
| # rm -f ${in}.nav ${in}.out ${in}.aux ${in}.log ${in}.snm ${in}.toc | |
| touch slides.pdf | |
| - name: Upload PDF for sharing with build-html | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slides-pdf | |
| path: slides.pdf | |
| build-html: | |
| runs-on: ubuntu-latest | |
| needs: build-pdf # wait for the PDF to be ready | |
| container: pandoc/core:latest-ubuntu | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download PDF artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: slides-pdf | |
| - name: Convert slides.md to index.html | |
| run: | | |
| mkdir -p _site | |
| # Write a small HTML snippet with the download link | |
| cat > /tmp/download-link.html << 'HTML' | |
| <p style="text-align:right; font-family:sans-serif;"> | |
| <a href="slides.pdf" download | |
| style="text-decoration:none; background:#24292f; color:#fff; | |
| padding:0.4em 0.9em; border-radius:4px; font-size:0.9em;"> | |
| ⬇ Download slides (PDF) | |
| </a> | |
| </p> | |
| HTML | |
| # Build index.html with the download link prepended | |
| pandoc slides.md \ | |
| --standalone \ | |
| --toc \ | |
| --include-before-body=/tmp/download-link.html \ | |
| --output "_site/index.html" | |
| # Copy figures/ so all image references resolve on the live site | |
| if [ -d "figures" ]; then | |
| cp -r figures _site/figures | |
| fi | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| needs: build-html | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |