With my deployments to s3 using github actions for some of my websites I noticed that there was a bit of replicated code for doing this deployment. I did have a peek at what was on the github market place to see what was available. But In the end I decided to just abstract out my code for deploying. It gave me a good chance to have my name to something on github market place and to learn more about the github tools around releases.
Pulling the similar code out was a relatively simple cut and paste job. Pass in the variables in instead of pulling them out manually.
I also took the time to optimise the deployment steps by using sync instead of delete then copy. From the docs sync checks for file changes and only copies those.
Testing it was a little hard. So I used one of my projects to have the file locally and run that workflow within a workflow. Which didnt really work, so I just released a v0.1.0and tested it out there. It worked which was nice and I was able to then release a v1.0.0
Introducing S3/Cloudfront: clear, copy & invalidate
Under the hood it does three things.
- Configures your credentials with AWS
- Syncs your changes with your S3 bucket
- Invalidates your cloudfront cache