1
- name : Build and Release LaTeX CV
1
+ name : build cv
2
2
3
3
on :
4
4
push :
5
5
branches :
6
6
- main
7
- tags :
8
- - ' *'
9
7
workflow_dispatch : # allow manual triggering
10
8
11
9
jobs :
12
10
build :
13
- runs-on : ubuntu-latest
11
+ runs-on : ubuntu-22.04
14
12
15
13
permissions :
16
14
contents : write
@@ -20,57 +18,59 @@ jobs:
20
18
- name : checkout repository
21
19
uses : actions/checkout@v3
22
20
21
+ - name : cache teX live
22
+ id : cache-texlive
23
+ uses : actions/cache@v3
24
+ with :
25
+ path : /usr/local/texlive
26
+ key : texlive-${{ runner.os }}-${{ hashFiles('main.tex') }}
27
+ restore-keys : |
28
+ texlive-${{ runner.os }}
29
+
30
+ - name : install teX live (if not cached)
31
+ if : steps.cache-texlive.outputs.cache-hit != 'true'
32
+ run : sudo apt-get update && sudo apt-get install -y texlive-full
33
+
23
34
- name : determine new version
24
35
id : get_version
25
- if : " !startsWith(github.ref, 'refs/tags/')"
26
36
run : |
27
37
git fetch --tags
28
-
29
- # Default to v0.0.0 if no tags exist
38
+
39
+ # default to v0.0.0 if no tags exist
30
40
latest_tag=$(git tag --sort=-v:refname | head -n 1 || echo "v0.0.0")
31
-
41
+
32
42
major=$(echo $latest_tag | cut -d'.' -f1 | tr -d 'v')
33
43
minor=$(echo $latest_tag | cut -d'.' -f2)
34
44
patch=$(echo $latest_tag | cut -d'.' -f3)
35
-
36
- # Increment version
45
+
46
+ # increment version
37
47
new_patch=$((patch + 1))
38
48
new_version="v${major}.${minor}.${new_patch}"
39
49
40
- echo "New version: $new_version"
50
+ echo "new version: $new_version"
41
51
echo "version=$new_version" >> $GITHUB_ENV
42
52
43
53
- name : compile laTeX document
44
- uses : xu-cheng/latex-action@v3
45
- with :
46
- root_file : main.tex
47
- args : " -jobname=KaplanKyla_CV"
48
-
49
- - name : ensure pdf exists
50
- run : |
51
- if [ ! -f KaplanKyla_CV.pdf ]; then
52
- echo "Error: compiled PDF not found!"
53
- exit 1
54
- fi
54
+ run : make -B # Forces LaTeX to recompile fully
55
55
56
56
- name : create github release
57
57
id : create_release
58
58
59
- if : " !startsWith(github.ref, 'refs/tags/')"
60
59
with :
61
60
tag_name : ${{ env.version }}
62
- release_name : " KaplanKyla CV ${{ env.version }}"
61
+ release_name : " ${{ env.version }}"
63
62
body : " automatically generated release."
64
63
draft : false
65
64
prerelease : false
66
65
env :
67
66
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
68
67
69
68
- name : upload pdf to release
70
- uses : softprops/action-gh-release@v1
71
- if : startsWith(github.ref, 'refs/tags/') || steps.create_release.outputs.upload_url
69
+ uses : actions/upload-release-asset@v1
72
70
with :
73
- files : KaplanKyla_CV.pdf
74
- body : " Curriculum Vitae compiled from LaTeX."
71
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
72
+ asset_path : KaplanKyla_CV.pdf
73
+ asset_name : KaplanKyla_CV.pdf
74
+ asset_content_type : application/pdf
75
75
env :
76
76
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments