GitHub-actions for hugo deployments

Share on:

Overview

How I setup github-actions to deploy my site to s3 on commit to main. I was already using hugo, hosted on S3 with route53, cloudfront and https. This post is specific to automated deployments.

References

High-level details

  1. added aws secrets to github
  2. setup new limited access in AWS
  • added new IAM user "githubcicd" and using access keys on this user
  • added new IAM policy "GitHubActionsPolicy", limited access to s3,cloudfront
  1. added deployment config in config.toml
  • name
  • s3 url
  • cloudFrontDistributionID
  1. added resources required to build in github
  • assets/scss
  • resources/_gen/assets/sass
  1. added file to automate deployment
  • .github/workflows/main.yaml