Skip to content

Commit

Permalink
[feat] add timestamp to generated file
Browse files Browse the repository at this point in the history
  • Loading branch information
markrofail committed Sep 27, 2024
1 parent e7c0c0d commit e50e785
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/generate_pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 8 additions & 3 deletions src/pdf_to_png.ts
Original file line number Diff line number Diff line change
@@ -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"),
})
})
2 changes: 1 addition & 1 deletion template/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e50e785

Please sign in to comment.