namesny-com/content/blog/resume_github_actions.md

64 lines
4.5 KiB
Markdown
Raw Permalink Normal View History

2023-09-28 19:48:00 +00:00
---
2023-10-02 20:45:29 +00:00
title: "Building My Resume with GitHub Actions"
date: "2023-10-02"
2024-01-05 19:31:31 +00:00
tags:
- cicd
2023-09-28 19:48:00 +00:00
---
2023-10-02 20:45:29 +00:00
Even if you are not actively looking for a new job, it is a good idea to have an up to date resume. I'm using Overleaf's GitHub integration and GitHub Actions to build PDF from my LaTeX resume and release it on GitHub
2023-09-28 19:48:00 +00:00
2023-10-02 20:45:29 +00:00
<!--more-->
2023-09-28 19:48:00 +00:00
2023-10-02 20:45:29 +00:00
## LaTeX
LaTeX is a typesetting system and document preparation tool known for its professional-quality typography and precise formatting capabilities. Widely used in academia, it's popular for creating resumes and academic documents due to its superior handling of complex formatting, mathematical equations, and citations. One of the benefits of using LaTeX is that it separates the content and formatting of a document, which makes it easier to focus on the content without worrying about the layout.
TeXLive is a comprehensive distribution of the LaTeX typesetting system, providing a wide range of packages, fonts, and utilities for users. It includes everything needed to create LaTeX documents, making it a go-to choice for many LaTeX users.
## Compiling PDF on Overleaf
I have been using [Overleaf](https://www.overleaf.com/) to edit, update and build my resume. Overleaf is a cloud-based LaTeX editor with countless templates for resumes, theses, presentations, cover letters, scientific papers and more. Overleaf uses TeXLive distribution, enabling their compile servers to provide a real-time preview of the typeset PDFs. This makes editing LaTeX on Overleaf very convenient since it is not necessary to understand the intricacies of document processing. Overleaf handles the complexities of LaTeX compilation, allowing you to concentrate on creating a standout resume. However, replicating the same results outside of Overleaf's environment requires deeper knowledge of the compilation process.
Overleaf uses [latexmk](https://ctan.org/pkg/latexmk?lang=en) package to automate the compilation. The package uses a system-wide configuration, which can be customized by a user-level configuration on a document-by-document basis. This customization might include adjusting the sequence of commands, specifying which files to include or exclude, defining custom dependencies, or setting up personalized error-handling procedures. You can access the `latexmk` configuration file used by Overleaf to typeset your document by compiling [this project](https://www.overleaf.com/learn/how-to/How_does_Overleaf_compile_my_project%3F#How_to_access_a_copy_of_Overleaf%E2%80%99s_LatexMk_file).
Because the template of my resume is quite simple it was not necessary to get the exact `latexmk` config file or to customize it in any way.
## Compiling and Releasing with GitHub Actions
Leveraging the power of GitHub Actions has streamlined my document compilation and release process significantly. Within the GitHub Actions Marketplace, there's a wealth of workflows tailored for various tasks, including LaTeX compilation. I've opted for [xu-cheng/latex-action](https://github.com/xu-cheng/latex-action) which utilizes the TeXLive environment and `latexmk` compiler, mirroring the setup used on Overleaf. And indeed without any configuration changes, my resume compiled to PDF correctly.
But automation doesn't stop there. To simplify the release procedure, I've incorporated [softprops/action-gh-release](https://github.com/softprops/action-gh-release). This action automates the creation of new tags, and releases, and even handles file attachments seamlessly. I've configured it to generate new releases marked with the current date, effortlessly adding the compiled `resume.pdf`. This automated process not only saves valuable time but also streamlines the release workflow, eliminating the need for manual login to Overleaf, recompilation, and downloading. It ensures that each new version of my resume is promptly available to the public.
You can check the full repository [here](https://github.com/LordMathis/resume). Alternatively here's just the workflow file:
```yaml
name: Release Compiled PDF
on:
push:
branches:
- master
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set up Git repository
uses: actions/checkout@v3
- name: Compile
uses: xu-cheng/latex-action@v2
with:
root_file: resume.tex
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NOW }}
files: ./resume.pdf
```