Skip to content

Commit 47c8ac1

Browse files
committed
feat: add gzip
1 parent 43fbfad commit 47c8ac1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ jobs:
5151
| S3_DESTINATION_DIR | false (defaults to S3 root) | Path to folder in a S3 bucket |
5252
| CLOUDFRONT_DISTRIBUTION_ID | false | Your CloudFront distribution |
5353
| CLOUDFRONT_PATHS | false (defaults to /*) | The paths to invalidate (relative to the distribution) |
54+
| USE_GZIP | false (defaults to false) | Use gzip for upload |

entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ if [ -z "$AWS_REGION" ]; then
2424
exit 1
2525
fi
2626

27-
sh -c "aws s3 sync $S3_SOURCE_DIR s3://$AWS_S3_BUCKET/$DESTINATION_DIR $*"
27+
if [ "$USE_GZIP" = true ]; then
28+
echo "Gzipping files..."
29+
find "$S3_SOURCE_DIR" -type f -exec gzip "{}" \; -exec mv "{}.gz" "{}" \;
30+
fi
31+
32+
sh -c "aws s3 sync $S3_SOURCE_DIR s3://$AWS_S3_BUCKET/$DESTINATION_DIR $([ "$USE_GZIP" = true ] && echo "--content-encoding gzip" || echo "") $*"
2833

2934
if [ -n "$CLOUDFRONT_DISTRIBUTION_ID" ]; then
3035
echo "Creating CloudFront invalidation"

0 commit comments

Comments
 (0)