Versioning your CV is important.
One traditional approach is to date it whenever you send it out.
I chose to present my CV on my website and host it on GitHub.
In this blog post I want to explain how I set up continuous integration pipeline for building my CV that automatically injects a unique version into each build.
This method is applicable for anyone choosing to ascii-based CV - in my case LaTeX.
You also need some basic knowledge of
Docker and CI services like
The Starting point
My CV is presented on a statically generated web page.
I recently changed this page to use Hugo for rendering.
Before automating the CV I built it locally using a
Makefile and commit the generated PDF file into
git repository as artifact.
The placeholder in the LaTeX file is
To make sure the replace operation matches only this one place I also added the surrounding curly braces to the matching string.
If your LaTeX file has a different setup you may need to modify the regular expression in the
Finally rendered you will see something like this
The complete workflow to update the CV:
There are a number of things that I did not like about my old setup:
Annoyances to get rid off
- need to commit twice to make a change
- artifacts are checked into
But also some things I really like about it:
Features to keep
- PDF can be previewed locally
- exact version of a CV can easily be viewed on GitHub
Given the pros and cons I was aiming for a workflow that generates artifacts on the server but allows me to preview them locally as much as possible. My ideal workflow for the web hosted CV is the following:
Get the git commit as CV version
With the old workflow the CV version is only updated whenever I ran the
Makefile and take the current git commit SHA as a version.
Using a continuous build approach this would be run for each commit.
As the CV is versioned & built within my website this would result in a new CV version even if the CV was not updated.
Therefore the current way to get a version needs to be changed.
# OLD: using the current HEAD revision of the repo git diff-index --quiet HEAD # NEW: HEAD revision of a specific file git rev-list --abbrev-commit -1 HEAD cv-anoff.tex
Drone CI Config
This tutorial will not cover how to set up drone, there are plenty of articles out there for that. The drone config file covers only on the CV specific steps:
- get the commit ID of the latest CV version
- inject commit ID as version into the CV
- build the CV using docker LaTeX container
Things that you might want to do after these steps are creating your static site using Hugo/Jekyll/Gatsby.. and publishing it via zeit/surge/gh-pages.. So many options 🤯
Note that the steps from the original
Makefile are not just executed sequentially in a single step.
That is mainly due to the fact that the thomasweise/texlive Docker image does not include
Instead of creating yet another docker image with all the dependencies needed (don’t be that person please) we can instead create a sequential build and separate those concerns.
The first step fetch-version executes the git command to get the correct SHA.
This is stored in a temporary file to be passed into the next pipeline step.
The build-cv step uses
sed to replace the version placeholder with the commit SHA and execute the PDF build using
The PDF is placed next to the input so it is best to place the
.tex file itself into a folder that is served as static asset.
Otherwise you may need an additional post processing step to move the file to an accessible location.
Support local build
There are two easy ways to support the create a local CV preview feature.
The first being the original
Makefile - it used to work and it still does work.
You may want to remove the
git commit step from the
Makefile though and add the
.gitignore to make sure the preview stays local.
Downside of this option is you may need to patch code at two different locations.
The second option is to use drone and its awesome drone CLI support to run parts of the pipeline locally. To achieve this install the drone CLI and either copy&paste or put the following line into a script file.
We started out with scripting git versioning a LaTeX based document.
Then we used a
Makefile to keep all the commands needed to automate the CV generation in one place.
In the final step I we from scripted and manually executed to scripted and fully automated generation of the PDF using the Drone continuous integration service.
If you have any questions DM me on Twitter anoff_io or leave a comment 👋