Skip to content

Commit

Permalink
Add size-only flag to aws s3 sync
Browse files Browse the repository at this point in the history
This will avoid re-upload if the file size doesn't change. Currently the
check on mtime is not very useful, as the local time of last
modification never will match the upload mtime on S3.

A better/safer mechanism would be to hash the file content and store it
as e-tag. These tickets discuss such a feature, but it isn't implemented
yet:
- aws/aws-cli#599
- aws/aws-cli#575
  • Loading branch information
or committed Jan 2, 2022
1 parent 9a0ef4d commit 4ec704d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prod-frontend-release:
yarn shadow-cljs release frontend --config-merge '$(PROD_CONFIG)'

prod-frontend-deploy: check-before-deploy-frontend prod-frontend-release
aws --profile heraldry-serverless s3 sync --acl public-read $(PROD_FRONTEND_RELEASE_DIR) s3://cdn.heraldry.digital
aws --profile heraldry-serverless s3 sync --size-only --acl public-read $(PROD_FRONTEND_RELEASE_DIR) s3://cdn.heraldry.digital
aws --profile heraldry-serverless s3 cp --acl public-read $(PROD_FRONTEND_RELEASE_DIR)/index.html s3://cdn.heraldry.digital/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
git tag $(shell date +"deploy-frontend-%Y-%m-%d_%H-%M-%S")
./invalidate-distribution.sh cdn.heraldry.digital
Expand Down Expand Up @@ -63,7 +63,7 @@ staging-frontend-release:
yarn shadow-cljs release frontend --config-merge '$(STAGING_CONFIG)' --config-merge '{:output-dir "./build/staging/js/generated"}'

staging-frontend-deploy: staging-frontend-release
aws --profile heraldry-serverless s3 sync --acl public-read $(STAGING_FRONTEND_RELEASE_DIR) s3://cdn.staging.heraldry.digital
aws --profile heraldry-serverless s3 sync --size-only --acl public-read $(STAGING_FRONTEND_RELEASE_DIR) s3://cdn.staging.heraldry.digital
aws --profile heraldry-serverless s3 cp --acl public-read $(STAGING_FRONTEND_RELEASE_DIR)/index.html s3://cdn.staging.heraldry.digital/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
./invalidate-distribution.sh cdn.staging.heraldry.digital

Expand Down

0 comments on commit 4ec704d

Please sign in to comment.