-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
84 lines (83 loc) · 2.89 KB
/
action.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
name: 'Compile and publish all LaTeX'
description: 'Checkout, compile LaTeX, compute a version, and deploy on GitHub in one shot.'
inputs:
token: # github token
description: 'Github token for deployment.'
required: true
# diff-enable:
# description: 'Github token for deployment. Skips deployment otherwise.'
# required: false
# default: false
# diff-files:
# description: Latex files (globs) to diff, if diff enabled
# required: false
# default: |
# **/*.tex
# diff-lightweight-tags:
# description: Whether non-annotated tags should be considered
# required: false
# default: false
# diff-tag-regex:
# description: Newline-separated list of tags to create differential documents with. Ruby Regex syntax supported.
# required: false
# default: |
# .*
publish-enable:
description: 'Whether the results should be deployed on GitHub. Defaults to true.'
required: false
default: true
runs:
using: "composite"
steps:
- name: Cache Docker images
uses: ScribeMD/docker-cache@0.5.0
with:
key: docker-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/*') }}
- name: Make ImageMagik permissive
shell: bash
run: sudo sed -i 's/rights=".*"/rights="all"/' /etc/ImageMagick-6/policy.xml
# Checkout the repository
- name: Checkout
uses: danysk/action-checkout@0.2.18
# - name: Prepare the differential documents
# uses: DanySK/auto-latexdiff@64.1.1
# id: latexdiff
# if: inputs.diff-enable == 'true'
# with:
# files: ${{ inputs.diff-files }}
# include-lightweight-tags: ${{ inputs.diff-lightweight-tags }}
# tags: ${{ inputs.diff-tag-regex }}
- name: Compile LaTeX
uses: DanySK/compile-latex-action@1.0.19
- name: Autotag
uses: DanySK/semver-autotag-action@0.1.0
- name: Deploy
if: inputs.publish-enable == 'true'
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
run: |
if [[ -z $GITHUB_TOKEN ]]; then
echo "No token set, cannot deploy"
false
else
if [[ $GITHUB_REF == 'refs/heads/master'
|| $GITHUB_REF == 'refs/heads/main'
|| $GITHUB_REF == 'refs/heads/default'
|| $GITHUB_REF == "refs/tags"*
]]; then
TAG=$(git describe --tags --exact-match HEAD)
echo "Preparing release $TAG"
git tag --delete "$TAG"
git tag "$TAG"
git push --tags && echo "Tag $TAG successfully pushed" || true
gh release create --notes-from-tag "$TAG" || true
while IFS= read -r file; do
pdf="${file%.*}.pdf"
echo "Delivering file $pdf"
gh release upload "$TAG" "$pdf" --clobber
done <<< "$LATEX_SUCCESSES"
else
echo "Not running deployment from unknown source: $GITHUB_REF"
fi
fi