-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
name: Compile PDF | ||
name: Compile LaTeX document | ||
on: [push] | ||
jobs: | ||
compile_latex: | ||
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 | ||
echo "PDF_NAME=$(cat pdf_name.txt)" >> $GITHUB_ENV | ||
- name: Compile LaTeX document | ||
uses: xu-cheng/latex-action@v3 | ||
with: | ||
root_file: main.tex | ||
- name: Upload PDF file | ||
latexmk_use_xelatex: true | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: main.pdf | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload PDF to Release | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: PDF | ||
name: ${{ env.PDF_NAME }} | ||
path: main.pdf | ||
- name: Produce a Release that includes the final PDF file. | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: main.pdf |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- logic/logic.lua | ||
local file = io.open(arg[1], "r") | ||
local title = nil | ||
|
||
if file then | ||
for line in file:lines() do | ||
local match = string.match(line, "\\title{(.+)}") | ||
if match then | ||
title = match | ||
break | ||
end | ||
end | ||
file:close() | ||
end | ||
|
||
if title then | ||
-- Remove non-alphanumeric characters and replace spaces with underscores | ||
title = title:gsub("[^%w%s]", ""):gsub("%s+", "_") | ||
print(title .. ".pdf") | ||
else | ||
print("document.pdf") | ||
end |
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