improve ci #72
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 Typst document | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
LANG: C.UTF-8 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: Pre-build operations | |
run: | | |
sudo apt-get install curl git unzip imagemagick libwebp-dev librsvg2-dev fonts-noto-cjk fonts-noto-cjk-extra | |
sudo apt-get remove fonts-noto-color-emoji | |
curl -OL https://github.com/typst/typst/releases/download/v0.10.0/typst-x86_64-unknown-linux-musl.tar.xz | |
xz -dc typst-x86_64-unknown-linux-musl.tar.xz | tar -x | |
sudo mv ./typst-x86_64-unknown-linux-musl/typst /bin/ | |
curl -OL https://github.com/lxgw/LxgwWenKai/releases/download/v1.320/lxgw-wenkai-v1.320.tar.gz | |
gzip -dc lxgw-wenkai-v1.320.tar.gz | tar -x | |
sudo mv lxgw-wenkai-v1.320 /usr/share/fonts/ | |
fc-cache | |
git clone https://github.com/OI-wiki/OI-wiki.git --depth=1 --single-branch -b master | |
cd remark-typst | |
npm install | |
cd .. | |
cd oi-wiki-export-typst | |
npm install | |
- name: Build Typst document | |
run: | | |
cd oi-wiki-export-typst | |
node index.js ../OI-wiki | |
typst -v compile oi-wiki-export.typ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: OI-wiki.pdf | |
path: ./oi-wiki-export-typst/oi-wiki-export.pdf |