|
| 1 | +name: Build LaTeX document |
| 2 | + |
| 3 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 4 | +# events but only for the main branch |
| 5 | +on: |
| 6 | + push: |
| 7 | + paths: |
| 8 | + - "**.tex" |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 12 | +jobs: |
| 13 | + # This workflow contains a single job called "build" |
| 14 | + build: |
| 15 | + # The type of runner that the job will run on |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 19 | + steps: |
| 20 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + persist-credentials: false |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + # - uses: docker://pandoc/latex:2.9 |
| 27 | + # with: |
| 28 | + # args: -f latex -t gfm --standalone --bibliography "writing/references.bib" --number-sections --reference-links --reference-location=document --output writing/paper/paper.md writing/paper/paper.tex |
| 29 | + # - name: Update README |
| 30 | + # run: | |
| 31 | + # echo "*This file has been automatically converted from [a LaTeX-sourcefile](paper.tex) using pandoc.*" > writing/paper/README.md |
| 32 | + # echo "References, figures, etc. are not necessarily correct. Please view the [PDF version](paper.pdf)." >> writing/paper/README.md |
| 33 | + # echo "" >> writing/paper/README.md |
| 34 | + # cat writing/paper/paper.md >> writing/paper/README.md |
| 35 | + # rm writing/paper/paper.md |
| 36 | + |
| 37 | + - uses: xu-cheng/latex-action@v2 |
| 38 | + with: |
| 39 | + # The LaTeX file(s) to be compiled |
| 40 | + root_file: paper.tex |
| 41 | + working_directory: writing/paper |
| 42 | + args: -pdf -file-line-error -interaction=nonstopmode |
| 43 | + |
| 44 | + |
| 45 | + - name: Commit files |
| 46 | + run: | |
| 47 | + git config --local user.email "[email protected]" |
| 48 | + git config --local user.name "GitHub Action" |
| 49 | + # git add -f writing/paper/README.md |
| 50 | + git add -f writing/paper/paper.pdf |
| 51 | + git commit -m "Automatically build compiled versions of updated paper" |
| 52 | + - name: Push changes |
| 53 | + |
| 54 | + with: |
| 55 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + branch: ${{ github.ref }} |
0 commit comments