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