This project demonstrates how to automatically deploy a static website to an Amazon S3 bucket using GitHub Actions on every push to the main branch.
static-app-s3-cicd/
βββ .github/
β βββ workflows/
β βββ main.yml # GitHub Actions workflow
βββ index.html # Homepage HTML
βββ styles.css # Styling
βββ script.js # Frontend JS
βββ README.md # Project documentation
- π¦ HTML, CSS, and JS static site
- π Automatic deployment to AWS S3
- π Uses GitHub Secrets for AWS credentials
- π§Ό Syncs with
--deleteto remove stale files
The GitHub Actions workflow does the following:
- β
Checks out the latest code from
main - π Configures AWS credentials from GitHub Secrets
- βοΈ Syncs the static site files to your S3 bucket
Workflow file:
.github/workflows/main.yml
on:
push:
branches: [main]-
AWS S3 bucket β Create one and make it public/static-site enabled
-
AWS IAM user with
s3:PutObject,s3:DeleteObject, ands3:ListBucketpermissions -
GitHub Secrets β Go to
Settings β Secrets and variables β Actions, and add:AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
-
Fork or clone this repository
-
Replace contents of:
index.html,styles.css, andscript.jswith your own site
-
Update the S3 bucket name in
main.yml:
aws s3 sync . s3://<your-bucket-name> --delete- Push to
mainβ GitHub Actions will deploy it automatically
After a successful push, your static site will be available at:
http://<your-bucket-name>.s3-website-<region>.amazonaws.com
Example:
http://jak-aws-bucket.s3-website-us-east-1.amazonaws.com
- HTML / CSS / JS
- AWS S3
- GitHub Actions
MIT License
Amit Kumar π GitHub