-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use GitHub Actions to build PDF files
- Loading branch information
Showing
5 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build Typst document | ||
on: [push, workflow_dispatch] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run | ||
run: | | ||
wget https://github.com/typst/typst/releases/download/v0.11.0/typst-x86_64-unknown-linux-musl.tar.xz | ||
tar -xf typst-x86_64-unknown-linux-musl.tar.xz | ||
mv typst-x86_64-unknown-linux-musl/typst . | ||
./setup-font.sh | ||
./compile.sh | ||
- name: Upload Build files | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: PDFs | ||
path: | | ||
./build | ||
- name: Get current date | ||
id: date | ||
run: echo "DATE=$(date +%Y-%m-%d-%H:%M)" >> $GITHUB_ENV | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: github.ref_type == 'tag' | ||
with: | ||
name: "${{ github.ref_name }} — ${{ env.DATE }}" | ||
files: "*.pdf" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
fonts/ | ||
build/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ | |
"**/.DS_Store": true, | ||
"**/Thumbs.db": true, | ||
"**/*.pdf": true, | ||
} | ||
"**/build/": true, | ||
}, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if [ ! -d "fonts" ]; then | ||
echo "Please create a folder named 'fonts' and put your fonts in it." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "build" ]; then | ||
mkdir -p build | ||
else | ||
rm -rf build/* | ||
fi | ||
|
||
for folder in $(ls -d */); do | ||
folder=${folder%?} | ||
if [ "$folder" == "fonts" ]; then | ||
continue | ||
fi | ||
if [ "$folder" == "build" ]; then | ||
continue | ||
fi | ||
echo "Compiling $folder" | ||
typst compile --font-path fonts/ ./$folder/main.typ build/${folder}.pdf | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
wget https://github.com/adobe-fonts/source-han-serif/releases/download/2.002R/01_SourceHanSerif.ttc.zip | ||
mkdir -p fonts | ||
unzip 01_SourceHanSerif.ttc.zip -d fonts | ||
rm 01_SourceHanSerif.ttc.zip |