DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Effective Microservices CI/CD With GitHub Actions and Ballerina
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Automate Web Portal Deployment in Minutes Using GitHub Actions
  • How GitHub Codespaces Helps in Reducing Development Setup Time

Trending

  • Traditional Testing and RAGAS: A Hybrid Strategy for Evaluating AI Chatbots
  • Navigating and Modernizing Legacy Codebases: A Developer's Guide to AI-Assisted Code Understanding
  • Advancing Robot Vision and Control
  • The Perfection Trap: Rethinking Parkinson's Law for Modern Engineering Teams
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. [CSF] Enable Continuous Delivery of Your Resume With GitHub Actions

[CSF] Enable Continuous Delivery of Your Resume With GitHub Actions

Here is my little secret: My resume lives in a private GitHub repository. I use TeX, which is a popular typesetting language, to compose my resume.

By 
Rahul Rai user avatar
Rahul Rai
DZone Core CORE ·
Oct. 26, 20 · Survey/Contest
Likes (6)
Comment
Save
Tweet
Share
10.6K Views

Join the DZone community and get the full member experience.

Join For Free

This is an entry for DZone's First Annual Computer Science Fair. Check out the rules and guidelines to see if your side project can win you some $$!

Here is my little secret: My résumé lives in a private GitHub repository. I use TeX, which is a popular typesetting language, to compose my résumé. TeX helps you separate document text from formatting. Major publishers whose content and design teams work independently of each other use TeX. The content team produces content, and the design team makes the content presentable. In a typical publishing workflow, the author marks various content such as headers, footers with inbuilt or custom TeX commands. Subsequently, the designer works on the document's typesetting by adjusting the presentation aspect of the commands.

TeX Primer

The predefined macros in TeX are quite limited. As an author, your manuscript might require fields such as footnotes and annotations, which are not available in TeX. LaTeX allows designers to extend the macros available to authors, which helps them focus on the content rather than formatting.

As an author, after writing a document using LaTeX, you require a LaTeX processor such as LuaTex, XeTeX, and pdfTeX to transform a TeX document to a PDF document. The various processors vary in their features, and therefore, you would need to find out which one produces optimal quality documents for your TeX files. I use XeTeX because it fits all my requirements.

All the popular TeX programs are generally packaged together, so you need not install each program individually. The TeXLive package includes binaries of the most popular TeX programs, macros, and fonts for all operating systems. Using the LaTeX Workshop extension, you can get the best of TeXLive in VSCode.

GitHub Actions

In a typical development workflow, GitHub stores the application code, and the CI\CD pipelines execute in an external service that integrates with GitHub using webhooks and personal access tokens. GitHub notifies the service of events such as push, and merge through webhooks, which kicks off the corresponding workflows in the service. GitHub has now patched this disconnect between your code and the DevOps services with a new feature named GitHub Actions.

Actions are units of code that can execute when certain GitHub events occur, such as pushing a branch. Since this service lives within GitHub, you need not use another DevOps service and connect it to your GitHub repository. There are hundreds of actions available in the GitHub marketplace, and this list is growing every day. You can also create custom Actions (we will build one), which are either Docker containers with your repository mounted as a volume to it or JavaScript code. Any discoverable Dockerfile or JavaScript script present either in your repository or a public repository can be used to build an action. To understand GH Actions in further detail, refer to the previous official documentation link.

DevOps for Résumé

Although it was just a fun project for me, DevOpsifying your résumé makes sense because:

  1. You get out of the box document versioning support.
  2. The latest version of the document is always available to you on your favorite website (GitHub).
  3. If someone (recruiter/client/company) asks you whether the document they have is the latest one, you only need to ask them one question (keep reading).
  4. If you get to talk about it in an interview, you will stand out! 

I understand that there are alternatives such as CMS, saving content to cloud drives, etc. However, I prefer this approach, and any real developer who firmly believes in the NIH philosophy will too (an * and some fine print here). Not just that, but by adding source control to your résumé, you can take advantage of features such as notes as commit messages for the changes that you made. The notes will help you remember the context behind recording something in your profile. For example, a simple statement such as "I improved the bug bounce rate from 20% to 10%" can carry the details in the commit message, such as what you did and why. You can look up the commits associated with any change with git blame and git log.

Code

The source code for this sample is available on my GitHub repository.

I recommend that you use the source code as a guide while building your application with me.

Step 1: Setup the Document Template

There are several LaTeX document templates available for free on the latextemplates.com website. I am going to use the Twenty Seconds Resume template for this demo. I recommend using the LaTeX workshop VSCode Extension for local development and debugging.

Download the Zip file of the document template from the LaTeX template website. Next, create a new GitHub repository and extract the contents of the template's zip file to your project folder.

Update the template.tex file with your details. As soon as you save the file, the LaTeX workshop extension will kick in and generate a PDF document from the Tex file as follows.

PDF document generated from the Tex file

PDF document generated from the Tex file

Make the template yours by adding your details in the appropriate sections of the document. We will automate the generation of the PDF document with a GitHub action rather than relying on the VSCode extension next.

Step 2: Add Version Information

Before we go about setting up GitHub Actions, let's make a minor change to the template. We will insert a placeholder in the template for adding the version information so that we know whether the recipient has the latest copy of the document. To do so, add the following text to the twentysecondcv.cls file.

LaTeX
 




xxxxxxxxxx
1


 
1
{GitHub Commit: \number \month .\number\year.verSubstitution}



The previous command adds the month number, the year number, and a string, verSubstitution, that we will substitute with the Git commit identifier through our GitHub Action later.

After adding the previous instruction to the twentysecondcv.cls file, you can view the version information in the generated document. Remember that the LaTeX VSCode extension generates PDF documents when you save the template.tex files, so you must save the template.tex file for the document to be updated.

Add version information to the Tex document

Add version information to the Tex document

Now that our document is ready let's create a GitHub Action for its delivery.

Step 3: Create GitHub Action

An Action is an individual task in the DevOps workflow. There are several actions available on the GitHub marketplace, but you can define custom actions as per your requirements, which we will do next.

Create a folder named actions and a folder named xelatex inside it. An action can be either a Docker container specification or a JavaScript action. Since we need to compile our document with the xelatex compiler, we will create a Docker action.

The first step of creating a Docker action is to create a Dockerfile. Create a file named Dockerfile and add the following instructions to it.

Dockerfile
 




xxxxxxxxxx
1
27


 
1
FROM debian:latest
2
 
          
3
LABEL "maintainer"="Rahul Rai <rahul@rahul-rai.com>"
4
LABEL "repository"="https://github.com/rahulrai-in/csf-resume-ops"
5
LABEL "homepage"="https://github.com/rahulrai-in/csf-resume-ops"
6
 
          
7
LABEL "com.github.actions.name"="Convert to PDF"
8
LABEL "com.github.actions.description"="Convert documents to PDF using xelatex."
9
LABEL "com.github.actions.icon"="code"
10
LABEL "com.github.actions.color"="blue"
11
 
          
12
# Install all xelatex and LaTeX dependencies
13
RUN apt-get update && \
14
    apt-get install --yes --no-install-recommends \
15
    texlive-fonts-extra \
16
    texlive-fonts-recommended \
17
    texlive-generic-recommended \
18
    texlive-lang-english \
19
    texlive-xetex && \
20
    apt-get autoclean && apt-get --purge --yes autoremove && \
21
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
22
 
          
23
ADD entrypoint.sh /entrypoint.sh
24
 
          
25
RUN chmod +x /entrypoint.sh
26
 
          
27
ENTRYPOINT ["/entrypoint.sh"]



Apart from the optional LABEL instructions, you can see that we installed several xelatex dependencies, such as fonts and the language. After installing the dependencies, we invoke the script named entrypoint.sh which compiles the .tex documents and generates PDF documents from them.

Please create a new file named entrypoint.sh and add the following instructions to it.

Shell
 




xxxxxxxxxx
1
22


 
1
#!/bin/bash
2
 
          
3
set -e
4
 
          
5
echo "Creating output directory $OUT_DIR..."
6
mkdir --parent $OUT_DIR
7
 
          
8
for fileName in *.tex *.cls; do
9
    [ -f "$fileName" ] || break
10
 
          
11
    echo "Substituting version number ${GITHUB_SHA::7} in file $fileName..."
12
    sed -i -e "s/verSubstitution/${GITHUB_SHA::7}/" $fileName
13
done
14
 
          
15
for fileName in *.tex; do
16
    [ -f "$fileName" ] || break
17
 
          
18
    echo "Converting file $fileName to pdf..."
19
    xelatex $fileName
20
done
21
 
          
22
cp *.pdf $OUT_DIR 2>/dev/null || :



Let's discuss what this script does. It first creates an output directory to store the generated PDF files. Next, it recursively goes through each .tex and *.cls file and replaces the string verSubstitution with the Git commit id. GitHub makes several environment variables available to the actions. For the full list of environment variables, refer to the GitHub action documentation. After text substitution, the script compiles each .tex document with the xelatex processor. The xelatex processor is the XeTeX typesetting engine for LaTeX. We installed XeTeX as part of TeX Live package in our Dockerfile.

Finally, the script copies all the generated PDF files to the output directory that it created earlier. The cp instruction can fail if it does not detect PDF files. Therefore, we made it direct stderr to a null device. This command will always report success. Probably not the best implementation, but it works.

Step 4: Create a Workflow

A workflow in GitHub actions is a pipeline comprising a sequence of actions. To define a workflow, create a folder named .github and a file named deploy.yaml. Add the following specification to the file.

YAML
 




xxxxxxxxxx
1
24


 
1
name: "Generate document"
2
on:
3
  push:
4
    branches: [main]
5
defaults:
6
  run:
7
    working-directory: .
8
jobs:
9
  build_deploy:
10
    runs-on: ubuntu-latest
11
    steps:
12
      - name: Checkout
13
        uses: actions/checkout@v2
14
 
          
15
      - name: Tex to PDF
16
        uses: ./actions/xelatex
17
        env:
18
          OUT_DIR: public
19
 
          
20
      - name: Upload artifacts
21
        uses: actions/upload-artifact@v2
22
        with:
23
          name: files
24
          path: public/



Let's discuss the specification in detail. We first defined the workflow's name and specified the condition that this workflow should be executed when we push a commit to the main branch. Next, we specified the location of the artifacts and the actions by setting the root as the working directory of the workflow. Next, we defined a job, which is an aggregation of actions, and the type of VM required - Ubuntu. The job comprises three actions that would execute in sequence.

  1. Checkout: It is a built-in action that downloads a copy of your repository.
  2. Tex to PDF: This is our custom action that receives the copy of our repository from the previous action and converts the TeX documents to PDF. It stores the generated PDF documents in a folder named public.
  3. Upload artifacts: This is another inbuilt action that takes the contents of a folder and uploads the contents of the folder as build artifacts in GitHub.

The following is the structure of a typical Action.

Plain Text
 




xxxxxxxxxx
1


 
1
action "Name" {
2
  uses = "points to public or local repo or a docker instruction"
3
  needs = "array of actions this action depends on"
4
  args = "array or string of arguments"
5
  secrets = ["SECRET_NAME"]
6
  env = {
7
    ENV_VARIABLE_NAME = "ENV_VAR_NAME"
8
  }
9
}



Push the code in its current state to the main branch. Head over to the Action tab to view the pipeline in action.

Showtime

In the Actions tab, click on the active workflow run as follows.

Select workflow run

Select workflow run

On the next screen, you can view the jobs and the actions that are part of the job executing sequentially.

Workflow job execution

Workflow job execution

You can expand the actions to view the logs generated by them during execution. Remember that the last action uploads the autogenerated PDF documents as artifacts generated from the workflow. Download the artifacts by clicking on the Artifacts button.

Download artifacts

Download artifacts

Inside the artifacts folder, you will find your document fresh off the DevOps pipeline. Let's verify the version information in the document.

Version added by GitHub workflow

Version added by GitHub workflow

Let us discuss the advantage of versioning your résumé. If a recruiter/interviewer wants to verify whether the copy they have is the latest one, you can ask them the version information that they see in the document. Just knowing the month and the year is sufficient most of the time, but with the commit SHA, you can also track the exact commit that generated the copy.

Conclusion

I love the DevOps model that GitHub adopted with Actions. There is no need to host the Action images yourself as the runtime builds them on the fly. This feature ensures that you need not connect your GitHub repository to systems outside the GitHub ecosystem, such as DockerHub. Co-locating the code with DevOps (and much more) is now a fascinating feature of GitHub.

This is an entry for DZone's First Annual Computer Science Fair. Check out the rules and guidelines to see if your side project can win you some $$!

GitHub Document Continuous Integration/Deployment workflow Docker (software) PDF Git LaTeX Repository (version control)

Opinions expressed by DZone contributors are their own.

Related

  • Effective Microservices CI/CD With GitHub Actions and Ballerina
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Automate Web Portal Deployment in Minutes Using GitHub Actions
  • How GitHub Codespaces Helps in Reducing Development Setup Time

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!