2

I'm wondering how I can get my server to automatically build a LaTeX project when I push to github. As it stands, I normally build the project locally, push to github, and then manually copy the PDF onto the server and move it into the correct spot. That said I'd really love a way to do this without the manual portion of copying onto the server. I don't normally include PDF's in my git repo.

I used to have Jenkins installed on the server and set it up with github so it would build the project when I pushed, but that feels like overkill for just building LaTeX projects where I really only need to run latexmk.

I've done some searching online and found

I've also found the idea that I could setup two remotes for my git repo and push to both github and my server at the same time, and have a post-recieve action set up through git. None of these feel particularly elegant, and hence I'm asking here to see if anyone else has other ideas.

  • 1
    you can see travis CI setup for running latex on commit in the main latex2e github repository https://github.com/latex3/latex2e/blob/master/.travis.yml – David Carlisle Nov 16 '20 at 22:52
  • 1
    @DavidCarlisle thanks for the suggestion, I didn't realize you could deploy with Travis, I thought it was just for CI/testing. Unfortunately they don't have an integration with digital ocean (the VPS provider I'm using), so I'm not sure that would work easily. – Nate Stemen Nov 16 '20 at 23:23
  • 4
    well we are using it for ci/testing but that involves running latex oddly enough:-) I realise it's not quite what you asked for (hence a comment not an answer) just a pointer to a related setup that you might be able to steal some ideas from, perhaps... – David Carlisle Nov 16 '20 at 23:28

1 Answers1

1

In case anyone comes here looking for an answer, I have an okay setup now.

I opted for github actions because I'm using github already. It's not ideal because lock-in, but it works. The action file is here: https://github.com/natestemen/cultvoucher/blob/main/.github/workflows/build.yml, but I'll describe it somewhat.

  1. First the action checks out the project with https://github.com/actions/checkout
  2. The project is then built with https://github.com/xu-cheng/latex-action which (I think) gives you full access to texlive.
  3. Finally it uses an scp action to copy the file to my server into a location that is symlinked to a served file on my website. The action is here https://github.com/appleboy/scp-action, and all secretes are handled by github.

I've only used it a few times since setting it up, but it's working well.