Hugo is supported for deploy on many platforms where this setup is not necessary.
But this is an application I can learn, understand how things work, and customize my own; and it’s fun!
Planning
In this phase, I’m going to plan and build out the CI/CD pipeline for when a pull request is merged to main it triggers a CodePipeline from a lambda function.
First, we’ll add the pull reqeust merged event API to the Dev Workflow pipeline. Eventually, we’ll update this to trigger CodePipeline.
- GitHub event triggered (PR-merged)
- Lambda Dispatcher
- SNS Pull Request – merged
- Lambda Pull Request – merged (Hello world logs)
Once that is complete, we’ll break down these steps and get those working.
- 🔲 Setup CodeBuild
- 🔲 Setup CodePipeline
- 🔲 Setup Lambda Pull Request – merged to trigger CodePipeline
Working backwards
Since the foundation infrastructure is already in place, let’s work backwards to implement the pull request merged function.
I’ll be working from the smylee-dev-workflows repo at this point in time.
Lambda Pull Request – merged
Fist I’ll create the files that will be needed for the lambda function. It will simply log the event that triggers the lambda function.
|
|
Infrastructure to run Lambda Pull Request – merged
Then I update the infrastructure code to include the new lambda function and SNS topic.
Then I updated the dispatcher to look for this new event and sent a message to the Pull Request Merged SNS topic.
☝️ Checkout this post on how to set up mermaid diagrams on hugo!
So now the dispatcher knows how to send a message if it’s pull request merge.
Next we’ll set up Code Build to trigger and then do the hugo site updates when the PR is merged to main.