Automated CV Generation

Automated CV Generation

Introduction

This is a tutorial on how to automatically generate a CV from a overleaf project using Github Actions. Since I maintain my CV in a private overleaf project, I wanted to have a way to automatically generate a PDF version of my CV and publish it on my website. This tutorial will show you how to do this.

Prerequisites

  • A Github account
  • A private overleaf project
  • A website hosted on Github Pages

Step 1: Create a Overleaf project

Create a new project on overleaf and add your CV content. Make sure to add a main.tex file to the root of your project. This file will be used to generate the PDF.

Step 2: Create a Github repository inside the private Overleaf project

Create a new Github repository inside your private overleaf project. This repository will be used to store the source code of your CV. It is convenient to use the same repository for both the source code and the PDF version of your CV. This way you can easily update your CV by pushing changes to the repository.

Also๏ผŒremember to use GitHub pages under the settings of your repository. This will allow you to host your CV on your website.

Step 3: Create a Github Action

Create a new file called .github/workflows/build.yml in your repository. This file will contain the Github Action that will be used to generate the PDF version of your CV.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Latex Build
run-name: $ is building Latex using GitHub Actions ๐Ÿš€
on: [push, pull_request]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - run: echo "๐ŸŽ‰ The job was automatically triggered by a $ event."
      - run: echo "๐Ÿง This job is now running on a $ server hosted by GitHub!"
      - run: echo "๐Ÿ”Ž The name of your branch is $ and your repository is $."
      - name: Check out repository code
        uses: actions/checkout@v3
      - run: echo "๐Ÿ’ก The $ repository has been cloned to the runner."
      - run: echo "๐Ÿ–ฅ๏ธ The workflow is now ready to compile your Latex on the runner."
      
      - name: Compile LaTeX document
        uses: xu-cheng/latex-action@v2
        with:
          root_file: main.tex
      - name: Override PDF file
        run: cp -f ./main.pdf ./docs/Siwei_Cui_CV.pdf
      # - name: Upload PDF file
      #   uses: actions/upload-artifact@v3
      #   with:
      #     name: PDF
      #     path: docs/Siwei_Cui_CV.pdf

      - name: Update resources
        uses: test-room-7/action-update-file@v1
        with:
            file-path: docs/Siwei_Cui_CV.pdf
            commit-msg: Update resources
            github-token: $

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: $
          publish_dir: ./docs

      - run: echo "๐Ÿ This job's status is $."

This action will be triggered every time you push changes to the repository. It will then compile the main.tex file and generate a PDF version of your CV. The PDF version will be stored in the docs folder. This folder will be used to host the PDF version of your CV on Github Pages.

Final Step: Test it out!

Now that you have created the Github Action, you can test it out by pushing changes to your repository. If everything works correctly, you should be able to see the PDF version of your CV on your website.