|
| 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: ObsCoreExtensionForRadioData |
| 10 | + doc_name : ObsCoreExtensionForRadioData |
| 11 | + branch_name: ${{ github.head_ref || github.ref_name }} |
| 12 | + tag_preview: auto-pdf-preview |
5 | 13 |
|
6 | 14 | on:
|
7 | 15 | push:
|
8 | 16 | branches:
|
9 |
| - - main |
| 17 | + - main |
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 apt update |
26 |
| - sudo apt install texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended xsltproc latexmk cm-super |
27 |
| - sudo snap install pdftk |
28 |
| - |
| 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 | +
|
29 | 38 | - name: Build the document
|
30 | 39 | run: make ${{ env.doc_name }}-draft.pdf
|
31 | 40 |
|
32 |
| - |
33 | 41 | - name: Check the output
|
34 | 42 | run: |
|
35 | 43 | test -f ${{ env.doc_name }}-draft.pdf
|
36 | 44 | test -f ${{ env.doc_name }}.bbl
|
37 |
| - |
38 |
| - - name: Move the auto-pdf-preview tag |
39 |
| - uses: weareyipyip/walking-tag-action@v2 |
40 |
| - with: |
41 |
| - tag-name: auto-pdf-preview |
42 |
| - tag-message: | |
43 |
| - Last commit taken into account for the automatically updated PDF preview of this IVOA document. |
| 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 |
44 | 55 | env:
|
45 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
46 |
| - |
47 |
| - - name: Update the PDF preview |
48 |
| - uses: Xotl/cool-github-releases@v1 |
49 |
| - with: |
50 |
| - mode: update |
51 |
| - isPrerelease: true |
52 |
| - tag_name: auto-pdf-preview |
53 |
| - release_name: "Auto PDF Preview" |
54 |
| - body_mrkdwn: | |
55 |
| - This release aims to provide a PDF preview of the last commit applied on this repository. |
| 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. |
56 | 61 | It will be updated automatically after each merge of a PullRequest.
|
57 |
| - **DO NOT PUBLISH THIS PRE-RELEASE!**" |
58 |
| - _Corresponding commit: ${{ github.sha }}_ |
59 |
| - assets: ${{ env.doc_name }}-draft.pdf |
60 |
| - replace_assets: true |
61 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
62 |
| - |
| 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