Skip to content

fixed issue in new workflow #7

fixed issue in new workflow

fixed issue in new workflow #7

Workflow file for this run

name: Build and Release LaTeX CV
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch: # allow manual triggering
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: determine new version
id: get_version
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
git fetch --tags
# Default to v0.0.0 if no tags exist
latest_tag=$(git tag --sort=-v:refname | head -n 1 || echo "v0.0.0")
major=$(echo $latest_tag | cut -d'.' -f1 | tr -d 'v')
minor=$(echo $latest_tag | cut -d'.' -f2)
patch=$(echo $latest_tag | cut -d'.' -f3)
# Increment version
new_patch=$((patch + 1))
new_version="v${major}.${minor}.${new_patch}"
echo "New version: $new_version"
echo "version=$new_version" >> $GITHUB_ENV
- name: compile laTeX document
uses: xu-cheng/latex-action@v3
with:
root_file: main.tex
- name: ensure pdf exists
run: |
if [ ! -f KaplanKyla_CV.pdf ]; then
echo "Error: compiled PDF not found!"
exit 1
fi
- name: create github release
id: create_release
uses: actions/create-release@v1.1.4
if: "!startsWith(github.ref, 'refs/tags/')" # Only create a release if not triggered by a tag push
with:
tag_name: ${{ env.version }}
release_name: "KaplanKyla CV ${{ env.version }}"
body: "automatically generated release."
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload pdf to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') || steps.create_release.outputs.upload_url
with:
files: cv.pdf
body: "Curriculum Vitae compiled from LaTeX."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}