Using GitHub Actions to deploy your static website to S3?

Great!

Using AWS S3 Sync command?

Amazing!

Did you make sure you have the `--size-only` flag on?

Without `--size-only`, your entire bucket will be uploaded each time your push to your branch. This includes contents that haven't changed at all.

Why?

By default, AWS S3 Sync compares the timestamp of your source and destination files. If the timestamp doesn't match - the file will be uploaded. This is a problem, since the files are newly created on each build (they are checked out as part of the workflow). To ensure only size is compared, use the `--size-only` flag like so:
1
aws s3 sync ./ s3://YOUR_BUCKET_NAME --size-only --exclude '.git/*' --exclude '.github/*'
p.s. You may have noticed I've also excluded the .git/ and .github/ folders.

You're welcome ;)