Skip to content

Commit 229a793

Browse files
authored
Merge pull request #89 from ivoa-std/loumir-patch-2
add preview workflow
2 parents 357f91d + 4b73fd0 commit 229a793

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

preview.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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 : ObsCoreExtensionForRadioData
11+
branch_name: ${{ github.head_ref || github.ref_name }}
12+
tag_preview: auto-pdf-preview
13+
14+
on:
15+
push:
16+
branches:
17+
- main
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 update
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+
39+
- name: Build the document
40+
run: make ${{ env.doc_name }}-draft.pdf
41+
42+
- name: Check the output
43+
run: |
44+
test -f ${{ env.doc_name }}-draft.pdf
45+
test -f ${{ env.doc_name }}.bbl
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
56+
env:
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.
62+
It will be updated automatically after each merge of a PullRequest.
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

Comments
 (0)