-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-guide-pdf-workflow.yml
More file actions
59 lines (53 loc) · 1.89 KB
/
build-guide-pdf-workflow.yml
File metadata and controls
59 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copy this file to .github/workflows/build-guide-pdf.yml to enable automatic PDF build on push.
# (GitHub web: create New file, path: .github/workflows/build-guide-pdf.yml, paste contents below.)
---
# Build Zixir Language complete guide PDF when the guide MD changes (or manually).
name: Build guide PDF
on:
workflow_dispatch:
push:
branches: [master, main]
paths:
- "docs/Zixir Language complete guide.md"
- "scripts/build-guide-pdf.*"
- ".github/workflows/build-guide-pdf.yml"
jobs:
build-pdf:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install pandoc and LaTeX
run: |
sudo apt-get update
sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic
- name: Build PDF
run: |
pandoc "docs/Zixir Language complete guide.md" \
-o "docs/Zixir Language complete guide.pdf" \
--pdf-engine=xelatex \
-V geometry:margin=1in \
-V fontsize=11pt \
-V documentclass=article \
--toc \
--toc-depth=2 \
-f markdown+smart
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: Zixir-Language-complete-guide-pdf
path: "docs/Zixir Language complete guide.pdf"
- name: Commit PDF to repo (if changed)
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "docs/Zixir Language complete guide.pdf"
if git diff --staged --quiet; then
echo "PDF unchanged, skip commit"
else
git commit -m "chore: update Zixir Language complete guide PDF"
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}