When using GitHub Actions do not use jobs and 'artifacts' between jobs

This is one of those “I should have known that” tips, but I have reworked my three GitHub action repos and some repos that depend on them, to avoid the use of jobs for each GHA because doing so requires to the use of GitHub Artifacts, which for sites with many images results in a very long ‘build’ time that consists mostly of lots of uploading and downloading huge tarballs.

The changes, which now just use ‘steps’ in the workflows and a single job reduced some builds from 10-15 minutes to 2-3 minutes (including an HTML validation stage and a link checking stage) including a test deployment. For smaller text-only repos the gains are still more than the raw GH time elapsed would suggest as there is also less latency for spinning up runners.

Of course, I’m not sure, with the state of GitHub’s documentation, that I had enough information about the runner environment and how things work in them to do everything side a single runner when I was first starting with Actions. I remember being concerned about the need for artifacts to communicate between stages but I had smaller sites and it wasn’t as painful in the beginning.

Now, I’m just happy I’ve gotten the speed back.

Hopefully this helps some else thinking of writing Actions and/or workflows for GitHub CI with Hugo.

1 Like