Skip to content
49 changes: 49 additions & 0 deletions .github/workflows/build-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Compile LaTeX and Publish PDF

on:
push:
branches:
- main
- '*'
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: write

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
# 1. Checkout repository code
- name: Checkout repository
uses: actions/checkout@v4

# 2. Compile LaTeX book to PDF
- name: Compile LaTeX
uses: xu-cheng/latex-action@v3
with:
root_file: book.tex

# 3. Save PDF as an Actions artifact (for downloading from the workflow run tab)
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: compiled-book
path: book.pdf

# 4. Create or update the 'latest' GitHub Release
- name: Publish to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: latest
name: "Latest Book Build"
body: "Automated build compiled from the latest push to `main`."
draft: false
prerelease: false
files: book.pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading