Skip to content

[feat] add action to generate pdf of textbook #25

[feat] add action to generate pdf of textbook

[feat] add action to generate pdf of textbook #25

Workflow file for this run

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 }}