Automated Latex Resume with GitHub Action
Tags: githubactions, automation, latex, resume
Published: 2024-05-12 17:49:44

This blog is originally post on https://blog.sahrohit.com.np/posts/automated-latex-resume and distributed across platforms for more reach.

Resumes are a crucial tool for developers. They are often the first impression you make on a potential employer, so it's important to have a well-formatted and ATS-friendly resume. However, keeping your resume updated across multiple platforms can be a hassle. This blog post explores how to use Latex and GitHub Actions to automate the resume update process.

## The Problem

Finding ATS-friendly resume templates is easy. The challenge lies in keeping your resume updated across various platforms, including your portfolio, GitHub README, and downloadable links. Manually updating each location can be time-consuming, error-prone and may lead to versioning hell of resume.

![Versioning Hell of my Resume’s](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jf277ighzdgxfatfal9z.png)

Versioning Hell of my Resume’s

## Solution Attempts

### Version Control with Git

I've always wanted to use Git to manage versions of my resume, but dealing with .docx files in Git isn't very enjoyable. My breakthrough with Git version control came when I switched to creating my resume in LaTeX. Not only is LaTeX ATS-friendly, but it's also easy to maintain since I can track changes in my Git repository. LaTeX does have a learning curve, but you can start editing in minutes by referring to guides on platforms like [Overleaf](https://www.overleaf.com), one of the best online LaTeX editors. This solved one of my problems, but updating links everywhere was still an issue.

Resume.tex - https://github.com/sahrohit/sahrohit/blob/master/resume.tex

Overleaf Link -  https://www.overleaf.com/read/qxxqjqgxcfzn#5da12c

### GitHub Actions for Automation

I decided to create a separate GitHub repository to manage my resume but realized that using the default README (same as my username) would be the best place to keep it. I used GitHub Actions to automate the build process, which generates and commits the PDF to the same repository. This setup serves two purposes: it checks whether the LaTeX file builds successfully and generates the PDF of my resume in my profile repository. The action only runs if there are changes in the resume.tex file, committing the generated PDF back to the same repository.

Additionally, the generated PDF is uploaded as an artifact and later downloaded to be committed to the portfolio repository. Currently, my portfolio is built with Next.js and includes the resume in the public folder, making it downloadable via the website.

```yaml
name: Build and Commit Resume

on:
  push:
    branches: [master]
    paths:
      - resume.tex

jobs:
  compile:
    name: Compile resume PDF
    runs-on: ubuntu-latest

    steps:
      - name: Check out Resume Repository
        uses: actions/checkout@v4
        with:
          repository: sahrohit/sahrohit

      - name: Run the build process with Docker
        uses: addnab/docker-run-action@v3
        with:
          image: thomasweise/docker-texlive-full:latest
          options: -v ${{ github.workspace }}:/data
          run: |
            cd data
            pdflatex resume.tex

      - name: Upload PDF artifact
        uses: actions/upload-artifact@v3
        with:
          name: resume-pdf
          path: resume.pdf

      - name: Commit and push changes
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: Updated Resume PDF

  commit:
    name: Commit resume to Portfolio
    needs: compile
    runs-on: ubuntu-latest

    steps:
      - name: Check out portfolio repo
        uses: actions/checkout@v4
        with:
          repository: sahrohit/portfolio
          token: ${{ secrets.ACCESS_TOKEN }}

      - name: Download PDF artifact
        uses: actions/download-artifact@v3
        with:
          name: resume-pdf

      - name: Move PDF to public directory
        run: |
          mv resume.pdf public/"Rohit's-Resume.pdf"

      - name: Commit and push changes
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: Updated Resume PDF
```

Upon changes to my [resume.tex](https://github.com/sahrohit/sahrohit/blob/master/resume.tex) file in the [sahrohit/sahrohit](https://github.com/sahrohit/sahrohit) repository, it generates a PDF and adds it to the same repository. Additionally, it creates a commit to update the resume in my portfolio ([sahrohit/portfolio](https://github.com/sahrohit/portfolio)). As [sahrohit/portfolio](https://github.com/sahrohit/portfolio) is private, for committing you'll need an ACCESS_TOKEN in project’s secrets to authorize the commit.

At the end of the day, what it does is save me a few manual commits and updates. But more than that, it gives me the satisfaction of updating the resume.tex file and initiating the entire process with a single commit. It's fulfilling to see how the resume updates across multiple places. It's these small satisfactions that keep us going and looking forward to another day.