Added combined and updated README.md #8
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: 📄 Compile LaTeX Document | |
on: | |
push: | |
branches: | |
- main # Set a branch to trigger the action | |
jobs: | |
build_latex: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🔄 Check Out Repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: 🛠️ Compile LaTeX Source | |
uses: xu-cheng/latex-action@v2 | |
with: | |
root_file: "*.tex" | |
glob_root_file: true | |
continue_on_error: true | |
- name: 📂 List Directory Contents | |
run: ls -al | |
- name: 📝 Find .tex Files and create Combined.tex | |
run: | | |
echo "\\documentclass{article}" > Combined.tex | |
echo "\\usepackage{pdfpages}" >> Combined.tex | |
echo "\\usepackage{titlesec}" >> Combined.tex | |
echo "\\begin{document}" >> Combined.tex | |
# Add the title page | |
echo "\\begin{titlepage}" >> Combined.tex | |
echo "\\centering" >> Combined.tex | |
echo "\\vspace*{\fill}" >> Combined.tex | |
echo "\\LARGE \textbf{<CourseName>}" >> Combined.tex | |
echo "\\Large <InstitutionName>" >> Combined.tex | |
echo "\\normalsize Author: <AuthorName>" >> Combined.tex | |
echo "\\vspace*{\fill}" >> Combined.tex | |
echo "\\end{titlepage}" >> Combined.tex | |
for file in $(ls *.tex | sort); do | |
# Exclude Combined.tex from the list | |
if [[ "$file" != "Combined.tex" ]]; then | |
# Replace .tex with .pdf | |
pdf_file="${file%.tex}.pdf" | |
echo "\\includepdf[pages=-]{$pdf_file}" >> Combined.tex | |
fi | |
done | |
echo "\\end{document}" >> Combined.tex | |
mv "Combined.tex" "CIT-5920-Lecture-Notes.tex" | |
- name: 🔍 Look at file content | |
run: cat "CIT-5920-Lecture-Notes.tex" | |
- name: 🛠️ Compile Combined.tex | |
uses: xu-cheng/latex-action@v2 | |
with: | |
root_file: "CIT-5920-Lecture-Notes.tex" | |
glob_root_file: true | |
continue_on_error: true | |
- name: 🏷️ Generate Release Tag | |
id: tag | |
run: | | |
echo "::set-output name=release_tag::Build_$(date +"%Y.%m.%d_%H-%M")" | |
- name: 📤 Upload Compiled PDF | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
files: "*.pdf" |