diff --git a/.github/workflows/generate_pdf.yml b/.github/workflows/generate_pdf.yml index 6d81c0c..36e5542 100644 --- a/.github/workflows/generate_pdf.yml +++ b/.github/workflows/generate_pdf.yml @@ -14,13 +14,11 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Use Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: "20.x" - run: npm ci - - run: npm run generate:latex - uses: xu-cheng/latex-action@v3 @@ -29,8 +27,8 @@ jobs: root_file: output.tex latexmk_use_xelatex: true - - run: mv template/output.pdf "output/markrofail-cv.pdf" - + - run: rm -rf output && mkdir output + - run: mv template/output.pdf "output/markrofail-$(date +"%Y-%m-%d").pdf" - run: npm run generate:png - uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/Makefile b/Makefile index 4471e0b..5c09529 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ render: npm run generate:latex cd template && xelatex output.tex - mv template/output.pdf "output/markrofail-cv.pdf" - # rm template/output.* + rm -rf output && mkdir output + mv template/output.pdf "output/markrofail-$(date +"%Y-%m-%d").pdf" + npm run generate:png diff --git a/src/pdf_to_png.ts b/src/pdf_to_png.ts index 16ca170..7ef57ea 100644 --- a/src/pdf_to_png.ts +++ b/src/pdf_to_png.ts @@ -1,9 +1,14 @@ +import fs from "fs" import path from "path" import { pdfToPng } from "pdf-to-png-converter" const ROOT_DIR = path.join(__dirname, "..") -pdfToPng(path.join(ROOT_DIR, "output/markrofail-cv.pdf"), { - viewportScale: 2.0, - outputFolder: path.join(ROOT_DIR, "output"), +fs.readdirSync(path.join(ROOT_DIR, "output")).forEach((file) => { + if (!file.endsWith(".pdf")) return + + pdfToPng(path.join(ROOT_DIR, "output", file), { + viewportScale: 2.0, + outputFolder: path.join(ROOT_DIR, "output"), + }) }) diff --git a/template/template.tex b/template/template.tex index 4ad47fc..2bd3a96 100644 --- a/template/template.tex +++ b/template/template.tex @@ -124,7 +124,7 @@ \section{Skills} \begin{tabular}{ll} <% Object.entries(skills).forEach(([skill, subSkills]) => { %> - \textbf{<%= skill %>} & <%= subSkills.join(", ") %> \\ + <%= skill %> & <%= subSkills.join(", ") %> \\ <% }) -%> \end{tabular} \sectionsep