aws-s3-sync
Sync build artifacts to S3, clean up old versioned assets, and optionally invalidate CloudFront.
Inputs
| Input |
Required |
Default |
Description |
source-dir |
Yes |
|
Local path to sync |
s3-bucket |
Yes |
|
Target S3 bucket name |
aws-role-arn |
Yes |
|
IAM role ARN for OIDC authentication |
cache-control |
No |
public, max-age=31536000, immutable |
HTTP Cache-Control header |
aws-profile |
No |
default |
AWS CLI profile name |
cloudfront-distribution-ids-file |
No |
"" |
Path to file with space-separated CloudFront distribution IDs |
retention-days |
No |
7 |
Delete _static/<timestamp> prefixes older than this many days (0 to skip) |
Usage
- uses: schmalz/shared-actions/.github/actions/aws-s3-sync@v1
with:
source-dir: dist/
s3-bucket: my-app-bucket
aws-role-arn: arn:aws:iam::123456789012:role/my-role
Notes
- Requires
enable-openid-connect: true on the job.
- Old assets under
_static/ are cleaned up based on retention-days by parsing timestamp-named prefixes.
- CloudFront invalidation uses
/* path and is triggered only when cloudfront-distribution-ids-file points to an existing file.