· Alexander · GitHub  · 3 min read

GitHub Actions - Automatically Build and Release Binaries

Automatically build and release binaries with GitHub Actions

Automatically build and release binaries with GitHub Actions

Welcome to part 4 of my GitHub Actions post series. This part will cover how to build and release a binary version of Caddy from GitHub Actions. In part 1 we got our Actions pipeline up and building a Docker container for our custom Caddy server image. In Part 2 we automated that process to kick off when changes were detected in the parent Caddy image using Diun. And in part 3 we automated updating our Linode VM to pull and re-deploy our updated container image. As this post is the 4th and final part of the GitHub Actions series, make sure to check out the previous 3 parts before trying to follow along with this post!

The Environment

I will be running this series as if you were running on Windows 10/11 with Visual Studio Code installed. Now this series can also be followed fairly easily if you are running on a straight Linux setup or WSL. I am also assuming you have a general understanding of the command line interface and are somewhat familiar with Docker. If you need more help leave a comment below and I will reach out!

Pre-Requisites

You should have these items created and set up before trying to follow this post.

Updating the Pipeline

First thing we need to do is to update our actions.yml file to include the binary building steps. Now this is completely up to you but I prefer to have the binary steps built before doing Docker images. This makes it easier to catch errors during the build process before accidentally pushing a broken image to your registry. Open the actions.yml file in your repo and add the following lines to it.

actions.yml
[Previous content with workflow configuration...]

Once the files are created we can commit and push our changes to GitHub.

Terminal window
git add .
git commit -m "Added binary building"
git push

The next time the action runs you should see a new release on your repository with a Linux and Windows binary for Caddy.

GitHub Release Example of a GitHub release with Caddy binaries

As you can see in the picture above the release was created with both caddy and caddy.exe binaries attached. It also includes a zip/tar of the source code (These archives are a copy of your repository not Caddy’s!). The title was created using the version pulled from the Get Binary Version step in the actions file. I am currently working on pulling the proper changelogs over for Caddy but I’m running into some formatting issues with it. Once I get it working I’ll update this post to include the action steps.

As always if you run into any issues please reach out either via a comment down below or through the email contact!

Thanks to my good friend Stefan for helping proof this post series!


FTC: Some links in this post are income earning affiliate links.
Back to Blog

Comments


Related Posts

View All Posts »