Wow, what a year! I mean, 2021 still hasn’t been my favorite, but it’s been a hell of a lot better than last year. Much more productive, anyway. I’ve made some serious updates to my two Github Actions available on the Marketplace, and I want to share with you what changes were made and why I decided to make them.

So without further ado, let’s jump straight into the more popular of the two!

Upstream Sync

The changes I made to this action really kicked off a whole new approach to how I write shell-based tools. The first few versions had all the code together in a single script, but as the project grew I found it was getting harder to keep track of the state of certain things. To deal with this, I split each piece of the action into its own small script and now call each step from a master script.

It might seem like overkill for a little action like this, but there are real benefits to this kind of architectural change. More flexibility, better testability, and better readability are just the start. It even exposed for me the fact that syncing from private repos wasn’t ever working correctly! So that’s been fixed. For good.

Test Mode

Since I split all the scripts, they’re now more testable! And you get to test them yourself with the new local test_mode. I love this feature. After configuring your workflow, you want to be sure it’ll work, right? Well, if you run your workflow with the test mode enabled, it will run a bunch of unit tests to determine if your configuration makes sense before you ever run your first sync. The action output will show you which tests are running as well as a success or failure status.

Upstream Sync test mode

While these tests don’t cover every possible issue, they do cover the basics. Does your upstream repo exist? Do your branches exist? Things like that. If you think more tests are needed, let me know!

Flexible Domain

You can now change the domain from github.com to any other base domain if your sync repo is not on Github. Maybe this will broaden the action’s user base? We’ll see! Thank you to @mathieucarbou for adding this feature.

Fixes

Of course there were some fixes! Nothing’s perfect. I mentioned before that syncing from private repos was never actually working as intended, and it turned out that I was having issues setting credentials when trying to access them. So that’s fixed! Along with that, there was a request for a GPG signing feature, which actually pushed me to discover and fix another problem – the git configuration being done by the Upstream Sync action was clashing with other actions run in the same workflow. Also fixed. Did I add GPG signing? No. But this makes it so that you can confidently add other actions into your workflow to support such needs.

Wiki

Documentation is a good thing, so I wrote a wiki. I felt there were enough ’non-standard’ sync scenarios cropping up that I needed write some help docs, and here they are – https://github.com/aormsby/Fork-Sync-With-Upstream-action/wiki. They aren’t super long, and it’s worth reading them to get familiar with the changes as well as how to set up for your specific use case if the action doesn’t work for you out of the box.

v2.4

For those of you seeking minimal changes to the actions you use, I released v2.4 as a fix for the private repo issues you may have encountered previously. It also includes the domain input variable. While this should be good enough to get you the fixes you need, please know that I will not make any further updates to v2.

Hugo Build and Deploy

On to the second action! Hugo Build and Deploy hasn’t had such a great showing in the past as its functionality was a bit flaky - but that’s going to change! If you’re seeing this post now, it means the action did its job building and publishing my site’s updates. Inspired by my changes to Upstream Sync, I also split all of the action steps into their own scripts. It really allowed me to figure out what was going wrong with this action as well as update it to follow a more modern continuous delivery pattern when publishing. While I really don’t expect the action to need many updates, I don’t expect it to cause trouble anymore, either.

Test Mode (Again)

Much like the other action, there’s a new test mode. Specifically, this action test if your branches and repos exists, but it also crucially helps you determine if you’ve set things up correctly for any sumbodules you might be publishing to. Personally, I’m moving away from submodule publishing for Hugo websites, and I plan on sharing why in a future post. But I know I lot of you might not be, and I wanted to make sure this action supports your needs clearly and safely.

Hugo Build and Deploy test mode

Branched Builds

Along with changes to the project, I’ve also made big changes to the action output. Previously, the action made site builds and pushed the changes to the same branch it got the source code from. That’s a problem because on some level that branch is pretty likely to be an active development branch. For many reasons, modern CD patterns dictate that development and release should remain separate. The updated deploy action fully supports that kind of separation.

Now when you configure the action, you choose your source-branch to pull from, and your release_branch to build to. The biggest benefit of this change is that you’ll now have a totally separate branch just for tracking your release history, and you won’t have any auto-build commit pollution in your working branches. Good stuff.

Wiki (Again)

See the pattern here? Good releases have documentation. https://github.com/aormsby/hugo-deploy-to-pages/wiki

Known Issue - Shallow Clones

Trying to get proper merges when using shallow clones during checkout has quite a problem. Thankfully, it doesn’t prevent the action from working, but it does mean you have checkout with fetch-depth: ‘0’ and pull the entire commit history when that may not be desirable behavior. See Git Shallow Clone Challenge for details, and maybe you can help.

Reach Out

I’m super thrilled to have some regular users of both of these actions, and I do my best to check in on their health every so often. If you have any questions, issues, or suggestions, I invite you to reach out by commenting here or opening an issue directly on these repositories.

In the meantime, what have you been up to? Tell me about it in the comments! Share a link, and I’ll read all about it. 🙂