Since moving this site to Eleventy back in December 2020 I've been continually improving my publication pipeline. It started out being a manual process running bits of hacked together code on my laptop before switching to my online tool of the day for pushing the changes to the hosted site.
For a long time I was using Forestry.io which is now discontinued and I never really took to it's replacement. So I settled on simply using Github for everything. This means the source for code is pushed from my laptop to Github, the published site is on Github Pages and the processing for creating the site from the source is managed through Github Actions. Initiallly triggering these three parts were things I did manually and separately.
I soon started scripting these actions in Powershell. The first script simply pushed the changes to github. I modified this to include a pull from github before the push, to ensure there were no conflicts when pushing. After running the script, I would manually switch to GitHub to run the workkflow in GitHub Actions that actually updated the site with the changes.
Well, yesterday I finally added that task to the script as well. Using the GitHub Rest API is straighforward and creating the correct curl command was relatively easy. But I don't know much about curl and in any case the script is a powershell script. Some Googling (mainly using Bing 🙂) got me most of the way there, by using the
Invoke-RestMethod. But I wasn't sure how to add one property to the command. Thankfully I found a code snippet on Stackoverflow which gave me what I needed. It had no explanations or comments, it was just posted as an answer to a question as is. Nevertheless it solved my problem.
And so this post becomes the first one pushed to GitHub and published on GitHub Pages using one integrated script. 👏