Skip to content

Instantly share code, notes, and snippets.

@valdo404
Last active July 25, 2023 20:26
Show Gist options
  • Save valdo404/b1f0034c3d61a594db1abc5602645db8 to your computer and use it in GitHub Desktop.
Save valdo404/b1f0034c3d61a594db1abc5602645db8 to your computer and use it in GitHub Desktop.
CV continuously deployed

Putting your CV under Continuous Deployment

In this era of digital advancement, why not put your CV under continuous deployment? This way, you can always keep your CV up-to-date and readily available for any potential opportunity. This post guides you through the process of putting your CV under continuous deployment using GitHub Actions.

Step 1: Making the Most of LaTeX

LaTeX is a high-quality typesetting system and in our case, we are using two particular document classes - Beamer for presentations and moderncv for the CV.

Moderncv

Moderncv provides a documentclass for typesetting modern curriculums vitae. It is aesthetic, clear, and easy to customize. In our workflow, we use it for cv.tex. Here's how to use it:

  1. Include the moderncv document class at the top of your .tex file:
\documentclass[11pt,a4paper,sans]{moderncv}
  1. You can then specify the theme and color to use, for example:
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{verbatim}
\usepackage{enumitem}

\renewcommand*{\namefont}{\fontsize{40}{48}\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\mdseries\upshape}
\renewcommand*{\addressfont}{\small\mdseries\upshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}

\renewcommand*{\namestyle}{\namefont\color{black}}
\renewcommand*{\titlestyle}{\titlefont\color{black}}
\renewcommand*{\addressstyle}{\addressfont\color{black}}
\renewcommand*{\quotestyle}{\quotefont\color{black}}
\renewcommand*{\sectionstyle}{\sectionfont\color[rgb]{0.0,0.0,0.8}} % Marine blue color
\renewcommand*{\subsectionstyle}{\subsectionfont\color[rgb]{0.0,0.0,0.8}} % Marine blue color
\renewcommand*{\hintstyle}{}

Beamer

Beamer is a powerful and flexible LaTeX class to create great looking presentations. In our workflow, we use it for cv-presentation.tex.

Include the Beamer document class at the top of your .tex file:

\documentclass{beamer}

XeLaTeX and Font Management

LaTeX uses its default font, but we may want to change it to something more appealing like Verdana. This is where XeLaTeX comes in. It is a typesetting system based on a merger of Donald Knuth's TeX system with Unicode and modern font technologies.

To use Verdana as your font in the .tex files, and adapt the rendering of your CV, add the following to your preamble:

\usepackage{fontspec}
\setmainfont[Path=./fonts/,
    BoldFont=Verdana_Bold.ttf,
    ItalicFont=Verdana_Italic.ttf,
    BoldItalicFont=Verdana_Bold_Italic.ttf
]{Verdana.ttf}

Assuming that the TTF files have dropped into local fonts directory

Then, you can compile your document using xelatex:

xelatex cv.tex
xelatex cv-presentation.tex

This way, you will generate PDFs that use the Verdana font. Note that you need to have the Verdana font installed on your system for this to work.

Step 2: Generate PDF Artifacts

Next, you need to generate PDF artifacts from your LaTeX documents. Here, we use a LaTeX Docker image. Below is a GitHub Action workflow that builds a PDF for each of the LaTeX files:

name: Build CVs
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v3

      - name: Compile LaTeX document
        uses: xu-cheng/latex-action@v2
        with:
          root_file: "*.tex"
          glob_root_file: true
          latexmk_use_xelatex: true

Step 3: Protect Sensitive Data

In the case of a CV, you might not want to expose your phone number to the public internet. For this, we are going to remove all emails and phone numbers so that they are not visible any more.

- name: Obfuscate email and phone number
  run: |
    sed -r -i 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/email-obfuscated/g' cv.tex
    sed -r -i 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/email-obfuscated/g' cv-presentation.tex
    sed -r -i 's/[+0-9-]{10,14}/phone-obfuscated/g' cv.tex
    sed -r -i 's/[+0-9-]{10,14}/phone-obfuscated/g' cv-presentation.tex

Step 4: Upload PDFs to GitHub Releases

Next, we upload the PDF files to a new release, which is only created when the build is launched on the master branch:

      - name: Get the version
        id: get_version
        run: echo ::set-output name=VERSION::$(date +%Y%m%d%H%M%S)
  
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        if: github.ref == 'refs/heads/master'
        with:
          tag_name: ${{ steps.get_version.outputs.VERSION }}
          release_name: Release ${{ steps.get_version.outputs.VERSION }}
          draft: false
          prerelease: false

      - name: Upload CV
        id: upload-cv 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        if: github.ref == 'refs/heads/master'
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./cv.pdf
          asset_name: cv.pdf
          asset_content_type: application/pdf
      
      - name: Upload Presentation
        id: upload-presentation 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        if: github.ref == 'refs/heads/master'
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./cv-presentation.pdf
          asset_name: cv-presentation.pdf
          asset_content_type: application/pdf

Step 5: Link to Latest Release in README

Finally, we generate links in our README.md file to point to the latest release of the CV. This way, anyone who visits the repository can easily download the latest version of your CV. We use a Python script to fetch the latest release and embed the links in the README file.

# CV and Presentation of Laurent Valdès

Welcome to the repository containing the CV and presentation slides of Laurent Valdès.

## Latest CV

You can download the latest version of my CV [here](https://github.com/your-github-handle/your-github-repo/releases/latest/download/cv.pdf) page.

## Latest Presentation

You can download the latest version of my Presentation [here](https://github.com/your-github-handle/your-github-repo/releases/latest/download/cv-presentation.pdf) page.

With the completion of these steps, your CV is now under continuous deployment. You can make updates at any time and they will be automatically built and published, keeping your CV up-to-date for any potential opportunity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment