Skip to content

Commit e19bea3

Browse files
committed
up workflow
#1
1 parent 9898ecd commit e19bea3

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/latex.yml

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
21
name: Compile Latex and Release PDF
32

4-
53
on:
64
push:
75
tags:
86
- 'v*'
97
branches:
108
- '*'
119

12-
1310
jobs:
1411
build_latex:
1512
runs-on: ubuntu-latest
@@ -23,42 +20,35 @@ jobs:
2320
steps:
2421
- name: Set up Git repository
2522
uses: actions/checkout@v4
23+
2624
- name: Get Repository Name
2725
id: repo_name
2826
run: |
29-
ls -lrt
3027
prefix=$(echo "${{ github.repository }}" | cut -d'/' -f2)
3128
echo "prefix=$prefix" >> "$GITHUB_OUTPUT"
3229
prefixwithref=$(echo "$prefix")-${{ github.ref_name }}
3330
echo "prefixwithref=$prefixwithref" >> "$GITHUB_OUTPUT"
3431
echo "pdf=$prefixwithref.pdf" >> "$GITHUB_OUTPUT"
3532
echo "tex=$prefix.tex" >> "$GITHUB_OUTPUT"
33+
3634
- name: Install hooks
3735
run: |
3836
sh ./setup-hooks.sh
3937
git checkout ${{ github.ref }} # checkout the branch or tag to update gitinfo2
38+
4039
- name: Compile LaTeX document
4140
uses: xu-cheng/latex-action@v3
4241
with:
4342
root_file: ${{ steps.repo_name.outputs.tex }}
4443
latexmk_shell_escape: true
4544
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 }}
5045

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 }}
5748

5849
- name: Upload Artifact
59-
uses: actions/upload-artifact@v4.1.0
50+
uses: actions/upload-artifact@v4
6051
with:
61-
# get the name of the repo without the organisation
6252
name: ${{ steps.repo_name.outputs.prefixwithref }}
6353
path: |
6454
./*.tex
@@ -74,8 +64,23 @@ jobs:
7464
!./.DS_Store*
7565
!./.gitignore*
7666
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
7984
id: create_release
8085
if: startsWith(github.ref, 'refs/tags/v')
8186
uses: softprops/action-gh-release@v2
@@ -88,4 +93,4 @@ jobs:
8893
token: ${{ secrets.GITHUB_TOKEN }}
8994
files: |
9095
${{ 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

Comments
 (0)