Skip to content

Add server-side KaTeX. #28

Add server-side KaTeX.

Add server-side KaTeX. #28

Workflow file for this run

name: Build and Deploy Website
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download Zola
run: curl -fLsS "https://github.com/getzola/zola/releases/download/v0.18.0/zola-v0.18.0-x86_64-unknown-linux-gnu.tar.gz" | tar xzf - -C /usr/local/bin
- name: Verify Zola binary
run: echo "3530d2626c3adcdc5cfcbfab0b736751269acd6f5352eaf60c3e105d939c8e74 /usr/local/bin/zola" | shasum -a 256 -b -c --strict
- name: Build website
run: zola build
- name: Check for server side KaTeX
run: grep -c "server_side_katex\s*=\s*true" config.toml | sed s/1/SERVER_SIDE_KATEX=true/ >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v4
if: ${{ env.SERVER_SIDE_KATEX == 'true' }}
- name: Install KaTeX
run: npm install katex
if: ${{ env.SERVER_SIDE_KATEX == 'true' }}
- name: Render KaTeX
run: node themes/academic-paper/scripts/katex.js
if: ${{ env.SERVER_SIDE_KATEX == 'true' }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public
name: github-pages
retention-days: 1
deploy:
needs: build
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@v3