Skip to content

Commit a118291

Browse files
committed
build: only build projects from main.typ
1 parent 4fbb1b1 commit a118291

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,29 @@ jobs:
2525
sudo apt-get update
2626
sudo apt-get install -y fonts-liberation fonts-jetbrains-mono fonts-noto
2727
28-
- name: Find all Typst projects
28+
- name: Find Typst projects with main.typst
2929
id: find_projects
3030
run: |
31-
echo "TYPST_FILES=$(find . -name "*.typ" | grep -v "_" | grep -v "/auxiliaries/" | tr '\n' ' ')" >> $GITHUB_ENV
31+
echo "TYPST_DIRS=$(find . -name "main.typst" -o -name "main.typ" | xargs dirname | tr '\n' ' ')" >> $GITHUB_ENV
3232
mkdir -p build
3333
34-
- name: Build PDFs from Typst files
34+
- name: Build PDFs from Typst projects
3535
run: |
36-
for file in $TYPST_FILES; do
37-
filename=$(basename "$file" .typ)
38-
dirname=$(dirname "$file")
39-
echo "Building $file to build/${dirname#./}/$filename.pdf"
40-
mkdir -p "build/${dirname#./}"
36+
for dir in $TYPST_DIRS; do
37+
if [ -f "$dir/main.typst" ]; then
38+
main_file="$dir/main.typst"
39+
else
40+
main_file="$dir/main.typ"
41+
fi
42+
43+
# Get relative path from repository root
44+
rel_dir="${dir#./}"
45+
46+
echo "Building $main_file to build/$rel_dir/main.pdf"
47+
mkdir -p "build/$rel_dir"
4148
4249
# Try to compile, continue if there's an error
43-
typst compile "$file" "build/${dirname#./}/$filename.pdf" || echo "Failed to build $file, continuing..."
50+
typst compile "$main_file" "build/$rel_dir/main.pdf" || echo "Failed to build $main_file, continuing..."
4451
done
4552
4653
- name: Generate README with links
@@ -67,3 +74,4 @@ jobs:
6774
folder: build
6875
branch: gh-pages
6976
clean: true
77+
commit-message: "Deploy Typst PDFs to GitHub Pages [skip ci]"

0 commit comments

Comments
 (0)