-
Notifications
You must be signed in to change notification settings - Fork 23
40 lines (34 loc) · 1.1 KB
/
generate-pdf.yml
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
name: Generate PDF for Textbook
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_and_generate_pdf:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Pandoc
run: sudo apt-get install -y pandoc texlive texlive-latex-extra
- name: Generate PDFs from the textbook Markdown files
run: |
pandoc memory-safety/vulnerabilities.md -V geometry:margin=1in --pdf-engine=pdflatex -o vulnerabilities.pdf
- name: Upload PDF to site
uses: actions/upload-artifact@v3
with:
name: textbook-full
path: vulnerabilities.pdf
- name: Commit and push changes only on push
if: github.event_name == 'push'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git add textbook_full.pdf
git commit -m "Update full PDF of textbook on site"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}