fixedgithub workflow #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release LaTeX CV | |
on: | |
push: | |
branches: | |
- main | |
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: Install TeX Live | |
run: sudo apt-get update && sudo apt-get install -y texlive-full | |
- name: Determine New Version | |
id: get_version | |
run: | | |
git fetch --tags | |
# Default to v0.0.0 if no tags exist | |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || 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 | |
run: make | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1.1.4 | |
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: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: KaplanKyla_CV.pdf | |
asset_name: KaplanKyla_CV.pdf | |
asset_content_type: application/pdf | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |