Add post draft. #57
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 and Deploy Website | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
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.19.1/zola-v0.19.1-x86_64-unknown-linux-gnu.tar.gz" | tar xzf - -C /usr/local/bin | |
- name: Verify Zola binary | |
run: echo "5a08302389d1ac6a54391984d414eba01b2b7b23d9ab410f51e87756ed0563bb /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/ | sed s/0/SERVER_SIDE_KATEX=false/ >> $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: Find KaTeX script directory | |
run: if [ -d scripts ]; then echo "KATEX_SCRIPT_DIR=scripts"; else echo "KATEX_SCRIPT_DIR=themes/academic-paper/scripts"; fi >> $GITHUB_ENV | |
if: ${{ env.SERVER_SIDE_KATEX == 'true' }} | |
- name: Render KaTeX | |
run: node $KATEX_SCRIPT_DIR/katex.js | |
if: ${{ env.SERVER_SIDE_KATEX == 'true' }} | |
- name: Copy KaTeX CSS and fonts | |
run: cp node_modules/katex/dist/katex.min.css public; cp -r node_modules/katex/dist/fonts public/fonts | |
if: ${{ env.SERVER_SIDE_KATEX == 'true' }} | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
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@v4 |