Skip to content

Build and Deploy

Build and Deploy #200

Workflow file for this run

name: CI
run-name: Build and Deploy
on:
push:
branches:
- master
paths-ignore:
- .gitignore
- README*
- LICENSE
- .github/**
- "!.github/workflows/ci.yml"
workflow_dispatch:
jobs:
build-typst:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: fontist/setup-fontist@v2
with:
fontist-version: "^1.21"
- run: fontist install "Libertinus Sans"
- name: Setup Typst
uses: typst-community/setup-typst@v4
with:
typst-version: ^0.14
cache-dependency-path: typst/requirements.typ
- run: rm -f typst/requirements.pdf
- run: typst --version
- run: typst fonts --font-path ~/.fontist/fonts
- run: typst compile --font-path ~/.fontist/fonts typst/syllabus.typ
- run: typst compile --font-path ~/.fontist/fonts typst/overview.typ
- run: typst compile --font-path ~/.fontist/fonts typst/jaccard.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-set-theory.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-relations.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-boolean-algebra.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-sat.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-logic.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-flow.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-formal.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-nfa.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-regular.typ
- run: typst compile --font-path ~/.fontist/fonts typst/lec-combinatorics.typ
- run: typst compile --font-path ~/.fontist/fonts typst/hw1.typ
- run: typst compile --font-path ~/.fontist/fonts typst/hw1-ru.typ
- run: typst compile --font-path ~/.fontist/fonts typst/hw2.typ
- run: typst compile --font-path ~/.fontist/fonts typst/hw3.typ
- run: typst compile --font-path ~/.fontist/fonts typst/hw4.typ
- name: List generated PDFs
run: ls -lh typst/*.pdf
- name: Upload PDFs as artifact
uses: actions/upload-artifact@v4
with:
name: pdf-typst
path: "typst/*.pdf"
build-tex:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build LaTeX project and generate PDFs
uses: xu-cheng/latex-action@v3
with:
working_directory: tex
root_file: "*.tex"
- name: Upload PDFs as artifact
uses: actions/upload-artifact@v4
with:
name: pdf-tex
path: "tex/*.pdf"
build-mdbook:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: "0.4.52"
# mdbook-version: 'latest'
- name: Build website with mdBook
run: |
cd docs
mdbook build
- name: Upload website artifact
uses: actions/upload-artifact@v4
with:
name: website
path: "docs/dist/"
deploy:
runs-on: ubuntu-latest
needs: [build-typst, build-tex, build-mdbook]
concurrency:
group: "pages"
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
pattern: "*"
- name: Show downloaded files
run: ls -R
- name: Prepare files for gh-pages
run: |
# Create public directory and copy website files first
mkdir -p public
cp -r website/* public/
# Copy all Typst PDFs to the root
cp pdf-typst/*.pdf public/
# Copy TeX PDFs to tex/ subdirectory
mkdir -p public/tex
cp pdf-tex/*.pdf public/tex/
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true