Manual deploys
Charles Harries
September 19, 2023
This website has been deploying using a GitHub Action for a little while now. The idea is that when I push new changes, the website should pull those changes down from GitHub and then do a little song and dance to install dependencies and bust caches. Simple enough. Or so you'd think! I struggled for a while to figure out a good way to handle this—using Deployer, trying to find a cheaper alternative to Forge, finally settling on what felt to me like a bit of an icky method: getting GitHub to SSH directly into my VPS and run the commands. This necessitated putting credentials in a GitHub "Secret", which I'm sure has top-notch security but felt like an unnecessary broadening of my attack surface. Well, no longer. The GitHub Action, after 250-odd runs, is no more. Instead, I've written a simple bash script that runs the deployment commands, and which I trigger from my computer instead. Manually SSH-ing into my server and running the command explicitly would be tiresome, so I've written a small alias for it instead: alias deploy='f() { ssh "cd /path/to/www/$1 && ./deploy.sh" };f' which I can then run pretty simply: $ deploy charlesharri.es There are a few benefits to doing it this way: I'm a lot more deliberate about re-deploying my siteI don't have to keep secrets on GitHubI don't have to debug GitHub Actions when something invariably falls overI can redeploy arbitrary sites on the same server, so long as they have an executable deploy.sh script at the project root #3 is the big one for me; time will tell how much more or less productive this workflow actually is. I suspect it's not going to make much of a difference.
Discussion in the ATmosphere