1
-
2
1
name : Compile Latex and Release PDF
3
2
4
-
5
3
on :
6
4
push :
7
5
tags :
8
6
- ' v*'
9
7
branches :
10
8
- ' *'
11
9
12
-
13
10
jobs :
14
11
build_latex :
15
12
runs-on : ubuntu-latest
@@ -23,42 +20,35 @@ jobs:
23
20
steps :
24
21
- name : Set up Git repository
25
22
uses : actions/checkout@v4
23
+
26
24
- name : Get Repository Name
27
25
id : repo_name
28
26
run : |
29
- ls -lrt
30
27
prefix=$(echo "${{ github.repository }}" | cut -d'/' -f2)
31
28
echo "prefix=$prefix" >> "$GITHUB_OUTPUT"
32
29
prefixwithref=$(echo "$prefix")-${{ github.ref_name }}
33
30
echo "prefixwithref=$prefixwithref" >> "$GITHUB_OUTPUT"
34
31
echo "pdf=$prefixwithref.pdf" >> "$GITHUB_OUTPUT"
35
32
echo "tex=$prefix.tex" >> "$GITHUB_OUTPUT"
33
+
36
34
- name : Install hooks
37
35
run : |
38
36
sh ./setup-hooks.sh
39
37
git checkout ${{ github.ref }} # checkout the branch or tag to update gitinfo2
38
+
40
39
- name : Compile LaTeX document
41
40
uses : xu-cheng/latex-action@v3
42
41
with :
43
42
root_file : ${{ steps.repo_name.outputs.tex }}
44
43
latexmk_shell_escape : true
45
44
post_compile : " latexmk -c; rm -rf _minted*"
46
- -
47
- name : Rename PDF
48
- run : |
49
- mv ${{ steps.repo_name.outputs.prefix }}.pdf ${{ steps.repo_name.outputs.pdf }}
50
45
51
- - name : Archive Article
52
- run : |
53
- temp_dir=$(mktemp -d)
54
- tar -czvf "${temp_dir}/${{ steps.repo_name.outputs.prefixwithref }}.tar.gz" --exclude="*.git*" --exclude="*.github*" --exclude="*.vscode*" --exclude="*.idea*" --exclude="*.gitignore" --exclude="*.DS_Store*" --exclude="images/" --exclude=".venv/" ./
55
- mv "${temp_dir}/${{ steps.repo_name.outputs.prefixwithref }}.tar.gz" ./
56
- rm -rf "$temp_dir"
46
+ - name : Rename PDF
47
+ run : mv ${{ steps.repo_name.outputs.prefix }}.pdf ${{ steps.repo_name.outputs.pdf }}
57
48
58
49
- name : Upload Artifact
59
- uses : actions/upload-artifact@v4.1.0
50
+ uses : actions/upload-artifact@v4
60
51
with :
61
- # get the name of the repo without the organisation
62
52
name : ${{ steps.repo_name.outputs.prefixwithref }}
63
53
path : |
64
54
./*.tex
74
64
!./.DS_Store*
75
65
!./.gitignore*
76
66
77
- -
78
- name : Create Release
67
+ - name : Download Artifact
68
+ uses : actions/download-artifact@v4
69
+ with :
70
+ name : ${{ steps.repo_name.outputs.prefixwithref }}
71
+ path : ${{ github.workspace }}/artifact
72
+ - name : List Artifact
73
+ run : ls -R ${{ github.workspace }}
74
+
75
+ - name : Check compilation of LaTeX document from artifact
76
+ uses : xu-cheng/latex-action@v3
77
+ with :
78
+ root_file : ${{ steps.repo_name.outputs.tex }}
79
+ latexmk_shell_escape : true
80
+ post_compile : " latexmk -c; rm -rf _minted*"
81
+ work_in_root_file_dir : ${{ github.workspace }}/artifact
82
+
83
+ - name : Create Release
79
84
id : create_release
80
85
if : startsWith(github.ref, 'refs/tags/v')
81
86
uses : softprops/action-gh-release@v2
88
93
token : ${{ secrets.GITHUB_TOKEN }}
89
94
files : |
90
95
${{ steps.repo_name.outputs.pdf }}
91
- ${{ steps.repo_name.outputs.prefixwithref }}.tar.gz
96
+ ${{ github.workspace }}/artifact/${{ steps.repo_name.outputs.prefixwithref }}.tar.gz
0 commit comments