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