⌚ Add CI for building book PDF #6
Workflow file for this run
This file contains hidden or 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
| 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@v4 | |
| with: | |
| root_file: book.tex | |
| args: "-pdf -interaction=nonstopmode" | |
| texlive_version: 2026 | |
| # 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 }} |