JAMES publication #14
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: Build LaTeX Document | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| build_latex: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Compile LaTeX document | ||
| uses: xu-cheng/latex-action@v4 | ||
| with: | ||
| root_file: main.tex # Replace with your main .tex file | ||
| working_directory: pub/ | ||
| compiler: latexmk # Or latexmk, xelatex, etc. | ||
| - name: Upload PDF artifact | ||
| id: upload_pdf | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: compiled-pdf | ||
| path: pub/main.pdf # Replace with the name of your compiled PDF | ||
| - name: Comment on PR with artifact link | ||
| if: github.event_name == 'pull_request' | ||
| env: | ||
| RUN_ID: ${{ github.run_id }} | ||
| REPO: ${{ github.repository }} | ||
| ARTIFACT_URL: ${{ steps.upload_pdf.outputs.artifact-url }} | ||
| run: | | ||
| SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) | ||
| COMMENT="🔗 [View PDF ($SHORT_SHA)](${ARTIFACT_URL})" | ||
| gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT" | ||
| shell: bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||