Build & Release Latex with Github Actions

In this post, I will be describing to setup a workflow to build and release your Latex files through Github actions. First of all, keep in mind that this post is not about what is Latex and how to use it.

It is extremely nice to integrate daily development tools such as CI/CD to your preparation of paper, without any hassle. Why is that because it is cool to track of what has been changed on a paper over time. In fact, having a couple of people who are responsible in different parts of paper, sometimes blocks others. Therefore, having such a workflow will increase productivity for everyone in a group. Whenever pull request created to main branch, it will be easy to check typos, logic errors and missing points by others.

Latex preparation

Skeleton

The given example structure can be changed according to your wishes, however important and logical part is that having main.tex on root directory of repository.

Once it is set, there is only one step to complete which is setting up Github Action workflows.

Setup Github Actions

It basically creates generated PDF file from provided Latex file, it can be set in workflow file as given below: (- Note that this workflow runs on tagged commits which has a tag with *.*.* pattern -)

However, setting up only this job is not sufficient enough to have completed workflow, we require to more jobs which are Create Release and Upload Release. As you may guess from their name, first one will create the release and second one will upload provided file to releases page. It can be setup as following

The given workflow is completed version of what you might have at the end. In summary, it builds PDF from provided Latex file, creates release and upload file to release. For more details, you can check information on each action page.

Proof of Concept

https://github.com/mrturkmenhub/latex-on-ci-cd

SS From Releases Page

Ahmet Turkmen © 2020

Originally published at https://mrturkmen.com on October 26, 2020.

Software Engineer at Aalborg University, Denmark