File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build Typst Projects
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ build :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+
18+ - name : Setup Typst
19+ uses : typst-community/setup-typst@v3
20+ with :
21+ typst-version : latest
22+
23+ - name : Find all Typst projects
24+ id : find_projects
25+ run : |
26+ echo "TYPST_FILES=$(find . -name "main.typ" | grep -v "_" | tr '\n' ' ')" >> $GITHUB_ENV
27+ mkdir -p build
28+
29+ - name : Build PDFs from Typst files
30+ run : |
31+ for file in $TYPST_FILES; do
32+ filename=$(basename "$file" .typ)
33+ dirname=$(dirname "$file")
34+ echo "Building $file to build/${dirname#./}/$filename.pdf"
35+ mkdir -p "build/${dirname#./}"
36+ typst compile "$file" "build/${dirname#./}/$filename.pdf"
37+ done
38+
39+ - name : Generate README with links
40+ run : |
41+ echo "# Typst Project PDFs" > build/README.md
42+ echo "" >> build/README.md
43+ echo "This branch contains automatically built PDFs from Typst source files." >> build/README.md
44+ echo "" >> build/README.md
45+ echo "## Available PDFs" >> build/README.md
46+ echo "" >> build/README.md
47+
48+ find build -name "*.pdf" | sort | while read pdf; do
49+ relative_path="${pdf#build/}"
50+ echo "- [$relative_path]($relative_path)" >> build/README.md
51+ done
52+
53+ - name : Deploy to GitHub Pages
54+ uses : JamesIves/github-pages-deploy-action@v4
55+ with :
56+ folder : build
57+ branch : gh-pages
58+ clean : true
You can’t perform that action at this time.
0 commit comments