Skip to content

Update compile.yml

Update compile.yml #12

Workflow file for this run

name: Compile LaTeX document
on:
push:
branches:
- master
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Extract PDF name from LaTeX title
run: |
sudo apt-get install -y lua5.3
lua logic/logic.lua main.tex > pdf_name.txt
TAG_NAME=$(cat pdf_name.txt | tr -d '\n')
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v3
with:
root_file: main.tex
latexmk_use_xelatex: true
- name: Rename PDF file
run: |
PDF_NAME=$(cat pdf_name.txt | tr -d '\n')
mv main.pdf "${PDF_NAME}.pdf"
env:
PDF_NAME: ${{ env.TAG_NAME }}
- name: Tag the release
id: tag_release
run: |
TAG=${TAG_NAME}
git tag $TAG
echo "::set-output name=tag::$TAG"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
TAG_NAME: ${{ env.TAG_NAME }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_release.outputs.tag }}
files: ${{ env.PDF_NAME }}.pdf
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Upload PDF to Release
uses: actions/upload-artifact@v4
with:
name: ${{ env.PDF_NAME }}
path: "${{ env.PDF_NAME }}.pdf"