resume/.forgejo/workflows/release.yml
Leonardo Murça b22bb49cec
All checks were successful
Compile LaTeX and Release PDF / build_latex (push) Successful in 1m11s
Add another commit
2025-03-07 09:23:52 -03:00

81 lines
2.8 KiB
YAML

name: Compile LaTeX and Release PDF
on:
push:
tags:
- 'v*'
jobs:
build_latex:
runs-on: [docker] # Use your Forgejo runner with the 'docker' label.
permissions:
contents: write
pull-requests: write
services:
docker:
image: docker:19.03.12-dind
options: --privileged
steps:
# Step 1: Setup git
- name: Set up Git repository
uses: actions/checkout@v3
with:
token: ${{ secrets.RELEASE_TOKEN }} # Use RELEASE_TOKEN instead of GITHUB_TOKEN
# Step 2: Install latex dependencies
- name: Install LaTeX Dependencies
run: |
apt-get update
apt-get install -y texlive texlive-latex-extra texlive-fonts-recommended latexmk
# Step 3: Create build directory
- name: Create dist directory
run: |
mkdir -p dist
# Step 4: Compile the LaTeX document
- name: Compile LaTeX document
run: |
latexmk -pdf -jobname=dist/leonardo-murca-resume main.tex
rm -f dist/leonardo-murca-resume.aux dist/leonardo-murca-resume.log dist/leonardo-murca-resume.out dist/leonardo-murca-resume.fls dist/leonardo-murca-resume.fdb_latexmk
# Step 5: Get commit messages for the release (from the tag)
- name: Get commit messages for the release
id: get_commit_messages
run: |
# Get the current tag name (e.g., v1.0.0)
TAG_NAME=${GITHUB_REF#refs/tags/}
# Find the previous tag (if it exists)
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "v*" $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
# Get commit messages between the previous tag and the current tag
if [ -z "$PREVIOUS_TAG" ]; then
COMMITS=$(git log --pretty=format:'- %s' $TAG_NAME --no-merges)
else
COMMITS=$(git log $PREVIOUS_TAG..$TAG_NAME --pretty=format:'- %s' --no-merges)
fi
# Store commit messages in environment variable
echo "commits<<EOF" >> $GITHUB_ENV
echo "$COMMITS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Step 6: Upload the compiled PDF as a release asset
- name: Upload PDF to Release
uses: actions/upload-artifact@v3
with:
name: leonardo-murca-resume.pdf # The file to upload as the release asset
path: dist/leonardo-murca-resume.pdf
# Step 7: Create release
- name: Create release
uses: actions/forgejo-release@v2
with:
token: ${{ secrets.RELEASE_TOKEN }}
release-dir: dist/
direction: upload
url: https://git.leomurca.xyz
repo: leomurca/resume
title: "Release ${{ github.ref_name }}"
release-notes: "${{ env.commits }}"