Skip to content

Commit 936c45d

Browse files
committed
going back to old workflow + caching
1 parent 2b6a8d5 commit 936c45d

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

.github/workflows/latex.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
name: Build and Release LaTeX CV
1+
name: build cv
22

33
on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- '*'
97
workflow_dispatch: # allow manual triggering
108

119
jobs:
1210
build:
13-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1412

1513
permissions:
1614
contents: write
@@ -20,57 +18,59 @@ jobs:
2018
- name: checkout repository
2119
uses: actions/checkout@v3
2220

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+
2334
- name: determine new version
2435
id: get_version
25-
if: "!startsWith(github.ref, 'refs/tags/')"
2636
run: |
2737
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
3040
latest_tag=$(git tag --sort=-v:refname | head -n 1 || echo "v0.0.0")
31-
41+
3242
major=$(echo $latest_tag | cut -d'.' -f1 | tr -d 'v')
3343
minor=$(echo $latest_tag | cut -d'.' -f2)
3444
patch=$(echo $latest_tag | cut -d'.' -f3)
35-
36-
# Increment version
45+
46+
# increment version
3747
new_patch=$((patch + 1))
3848
new_version="v${major}.${minor}.${new_patch}"
3949
40-
echo "New version: $new_version"
50+
echo "new version: $new_version"
4151
echo "version=$new_version" >> $GITHUB_ENV
4252
4353
- 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
5555

5656
- name: create github release
5757
id: create_release
5858
uses: actions/[email protected]
59-
if: "!startsWith(github.ref, 'refs/tags/')"
6059
with:
6160
tag_name: ${{ env.version }}
62-
release_name: "KaplanKyla CV ${{ env.version }}"
61+
release_name: "${{ env.version }}"
6362
body: "automatically generated release."
6463
draft: false
6564
prerelease: false
6665
env:
6766
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6867

6968
- 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
7270
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
7575
env:
7676
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)