Skip to content

Commit fdf3309

Browse files
committed
Typst CI
1 parent b86e9a0 commit fdf3309

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/ci-typ.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Typst CI
2+
3+
on:
4+
push: # Run CI for all branches except GitHub merge queue tmp branches
5+
branches-ignore:
6+
- "gh-readonly-queue/**"
7+
pull_request: # Run CI for PRs on any branch
8+
merge_group: # Run CI for the GitHub merge queue
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dtolnay/rust-toolchain@stable
16+
17+
- name: Install Python dependencies
18+
run: |
19+
pip3 install --user python-dateutil linkchecker
20+
- name: Put pip binary directory into path
21+
run: echo "~/.local/bin" >> $GITHUB_PATH
22+
23+
- name: Cache Cargo installed binaries
24+
uses: actions/cache@v4
25+
id: cache-cargo-typst
26+
with:
27+
path: ~/cargo-bin
28+
key: cache-cargo
29+
- name: Install Typst
30+
if: steps.cache-cargo.outputs.cache-hit != 'true'
31+
uses: actions-rs/install@v0.1
32+
with:
33+
crate: typst-cli
34+
version: latest
35+
- name: Copy typst to cache directory
36+
if: steps.cache-cargo.outputs.cache-hit != 'true'
37+
run: |
38+
mkdir -p ~/cargo-bin
39+
cp ~/.cargo/bin/typst ~/cargo-bin
40+
- name: Put new cargo binary directory into path
41+
run: echo "~/cargo-bin" >> $GITHUB_PATH
42+
43+
- name: Build original (English) book
44+
run: |
45+
cp -a html-assets/. book/
46+
typst compile --features bundle,html -f bundle --input lang=en typ/book-html.typ book
47+
typst compile --input lang=en --input target=pdf typ/book-pdf.typ book/rust_embedded_book_en.pdf
48+
49+
- name: Build translated book
50+
run: |
51+
typst compile --features bundle,html -f bundle --input lang=cn typ/book-html.typ book/cn
52+
typst compile --input lang=cn --input target=pdf typ/book-pdf.typ book/rust_embedded_book_cn.pdf
53+
typst compile --features bundle,html -f bundle --input lang=de typ/book-html.typ book/de
54+
typst compile --input lang=de --input target=pdf typ/book-pdf.typ book/rust_embedded_book_de.pdf
55+
typst compile --features bundle,html -f bundle --input lang=uk typ/book-html.typ book/uk
56+
typst compile --input lang=uk --input target=pdf typ/book-pdf.typ book/rust_embedded_book_uk.pdf
57+
58+
- name: Check links
59+
run: linkchecker book
60+
61+
- name: Deploy book
62+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
63+
uses: peaceiris/actions-gh-pages@v3
64+
with:
65+
github_token: ${{ secrets.GITHUB_TOKEN }}
66+
publish_dir: book
67+
force_orphan: true

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Copy mdbook to cache directory
3636
if: steps.cache-cargo.outputs.cache-hit != 'true'
3737
run: |
38-
mkdir ~/cargo-bin
38+
mkdir -p ~/cargo-bin
3939
cp ~/.cargo/bin/mdbook ~/cargo-bin
4040
- name: Put new cargo binary directory into path
4141
run: echo "~/cargo-bin" >> $GITHUB_PATH

0 commit comments

Comments
 (0)