Not Building a Commit With AWS Amplify
I've got to say that I really like AWS Amplify. I haven't used it for much other than this blog, but I really like the fact that it's cheap, it was easy to setup and it continues to work without giving me headaches.
One thing that I was looking into though was how to have it not build on every commit I push. I'm using my git repository as my source of truth and manually syncing my various clients. This multiple client setup means that sometimes I start writing something on one device, then pick it up on another to finish it up before publishing it. I'd rather not run a full build in Amplify when I push a commit that isn't going to be published, so I took a look to see what I could do. It turns out there's a couple of ways to do what I want to do.
Method One - Add [skip-cd] To The Commit Message #
The first method I found is pretty straightforward - just add [skip-cd]
to the tail end of your commit message and Amplify will ignore it. This isn't the most ideal way for me, because I will need to remember to add this to my commit, but given my current setup it will probably be easiest for the time being.
https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html#skip-build-for-a-commit
Method Two - Run A Diff Of The Changes #
The second method I found is more what I was thinking of - configuring Amplify to look for differences along specific paths to determine if a build is necessary. Unfortunately I did not setup my blog to be in a subdirectory of my project so telling Amplify to watch just one path won't work. But I'll think about this in the future and maybe change some things around to take advantage of it.
https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html#enable-diff-deploy
Bonus tip: if you happen to be on iOS or MacOS and you don't want to type out [skip-cd]
every time, you can setup a text expansion (called "text replacement") in settings. This way, typing this out on an iPhone keyboard is easier as you don't have to switch to the keys that allow you to type [
and ]
.
- Next: Don’t Leave Comments On Your PR
- Previous: Good Advice