|
| 1 | +# This file generated from a template file maintained in the ivoatex repository. |
| 2 | +# To create and install it into a project repository, do: |
| 3 | +# make github-preview |
| 4 | +# git commit |
| 5 | +# git push |
| 6 | +# |
| 7 | +name: Update PDF Preview |
| 8 | + |
| 9 | +env: |
| 10 | + doc_name : IAP |
| 11 | + branch_name: ${{ github.head_ref || github.ref_name }} |
| 12 | + tag_preview: auto-pdf-preview |
| 13 | + |
| 14 | +on: |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - master |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + |
| 26 | + - name: Checkout the repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + submodules: true |
| 30 | + |
| 31 | + - name: Setup dependencies |
| 32 | + run: | |
| 33 | + sudo apt install texlive-latex-base texlive-latex-recommended \ |
| 34 | + texlive-latex-extra texlive-fonts-recommended \ |
| 35 | + librsvg2-bin latexmk \ |
| 36 | + pdftk xsltproc latexmk cm-super |
| 37 | +
|
| 38 | + - name: Build the document |
| 39 | + run: make ${{ env.doc_name }}-draft.pdf |
| 40 | + |
| 41 | + - name: Check the output |
| 42 | + run: | |
| 43 | + test -f ${{ env.doc_name }}-draft.pdf |
| 44 | + test -f ${{ env.doc_name }}.bbl |
| 45 | +
|
| 46 | + - name: Remove the former PDF preview (if any) |
| 47 | + run: | |
| 48 | + existingTag=$( gh release list --exclude-drafts --json 'isPrerelease,tagName' \ |
| 49 | + --jq '.[] | select(.isPrerelease == true and .tagName == "${{ env.tag_preview }}") | .tagName' \ |
| 50 | + | xargs -n 1 echo ) |
| 51 | + if [ -n "$existingTag" ]; |
| 52 | + then |
| 53 | + gh release delete --cleanup-tag "$existingTag" |
| 54 | + fi |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Upload the new PDF preview |
| 59 | + run: | |
| 60 | + RELEASE_NOTES="This release aims to provide a PDF preview of the last commit applied on this repository. |
| 61 | + It will be updated automatically after each merge of a PullRequest. |
| 62 | + **DO NOT PUBLISH THIS PRE-RELEASE!** |
| 63 | + _Corresponding commit: ${{ github.sha }}_" |
| 64 | +
|
| 65 | + gh release create ${{ env.tag_preview }} \ |
| 66 | + ${{ env.doc_name }}-draft.pdf \ |
| 67 | + --prerelease \ |
| 68 | + --target "${{ env.branch_name }}" \ |
| 69 | + --title 'Auto PDF Preview' \ |
| 70 | + --notes "$RELEASE_NOTES" |
| 71 | + env: |
| 72 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + |
0 commit comments