feat: sync 4 zen papers from hanzo/papers/zen #12
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 Papers to PDF | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - '**.tex' | |
| - '.github/workflows/compile-papers.yml' | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - '**.tex' | |
| workflow_dispatch: | |
| # Grant write permissions for creating releases and committing PDFs | |
| permissions: | |
| contents: write | |
| jobs: | |
| compile-pdfs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install LaTeX | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y texlive-full | |
| - name: Compile all LaTeX papers | |
| run: | | |
| mkdir -p pdfs | |
| # Find all main .tex files (not in subdirectories) | |
| for texfile in *.tex; do | |
| if [ -f "$texfile" ]; then | |
| echo "Compiling $texfile..." | |
| # Get base name without extension | |
| basename="${texfile%.tex}" | |
| # Compile LaTeX (run 3 times for references) | |
| pdflatex -interaction=nonstopmode "$texfile" || true | |
| bibtex "$basename" 2>/dev/null || true | |
| pdflatex -interaction=nonstopmode "$texfile" || true | |
| pdflatex -interaction=nonstopmode "$texfile" || true | |
| # Move PDF to pdfs directory if compilation succeeded | |
| if [ -f "${basename}.pdf" ]; then | |
| mv "${basename}.pdf" pdfs/ | |
| echo "✓ Successfully compiled ${basename}.pdf" | |
| else | |
| echo "✗ Failed to compile ${basename}.pdf" | |
| fi | |
| # Clean up auxiliary files | |
| rm -f *.aux *.log *.bbl *.blg *.out *.toc *.lof *.lot | |
| fi | |
| done | |
| # List all generated PDFs | |
| echo "" | |
| echo "Generated PDFs:" | |
| ls -lh pdfs/ || echo "No PDFs generated" | |
| - name: Upload PDFs as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: compiled-papers | |
| path: pdfs/*.pdf | |
| retention-days: 90 | |
| - name: Commit PDFs back to repository | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add pdfs/*.pdf 2>/dev/null || true | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-generated PDFs from LaTeX sources [skip ci]" | |
| git push | |
| fi |