How to Deploy a React App to S3 and CloudFront Using GitHub Actions
Every time you push to main, you want your React app built and live — not a manual aws s3 sync from your laptop. Setting up a GitHub Actions workflow that runs npm run build and deploys to S3 with CloudFront invalidation is straightforward once you understand the IAM surface and the ordering of operations. Get either wrong and you end up with stale cache or a pipeline that works on your machine but fails in CI. TL;DR: React App Deployment to S3 and CloudFront Phase Tool Key Action Build GitHub Actions + Node npm ci && npm run build Upload AWS CLI aws s3 sync ./build s3://your-bucket --delete Invalidate CloudFront API aws cloudfront create-invalidation Auth OIDC (recommended) No long-lived AWS credentials in GitHub Secrets How the Deployment Pipeline Works Before writing a single line of YAML, it helps to understand what actually happens between a git push and a user seeing updated conten...