Github - Deploying a React Next.js App to AWS S3 with Github Actions

Create a workflow for staging and production instances

Click on Actions tab within the Github repo and then Press on New workflow

You can skip this (Choose a workflow template) and click the Setup a workflow yourself and start from scratch.

Setup workflow files

production.yml

staging.yml

Replace NEXT_PUBLIC_APP_ENV with the environment where you're running this app. Replace NEXT_PUBLIC_API_URL with your backend API host. Replace AWS_REGION with the region where you created your bucket. Replace SOURCE_DIR with the local directory (or file) you wish to sync/upload to S3. Replace PATHS with a list of one or more space-separated paths to invalidate.

Add AWS secrets to Github

Push code to Github then Github Action will deploy your app to an S3 Bucket automatically

Last updated

Was this helpful?