1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-14 13:24:25 -04:00

set certain content-types manually because S3 sucks at guessing

This commit is contained in:
2019-02-15 13:30:12 -05:00
parent 8e14b04754
commit d00951a09e

View File

@@ -18,7 +18,7 @@ build:
- hugo
artifacts:
paths:
- public
- public
deploy:
stage: deploy
@@ -28,7 +28,23 @@ deploy:
script:
- pip install awscli
- aws configure set preview.cloudfront true
- aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --metadata-directive REPLACE
- aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --cache-control "max-age=86400, public" --metadata-directive "REPLACE"
# set certain content-types manually because S3 sucks at guessing
- aws s3 cp --exclude "*" --include "*.ico" --content-type="image/x-icon" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.svg" --content-type="image/svg+xml" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.ttf" --content-type="font/ttf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.otf" --content-type="font/otf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.eot" --content-type="application/vnd.ms-fontobject" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.woff" --content-type="font/woff" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.woff2" --content-type="font/woff2" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.xml" --content-type="text/xml" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.mp4" --content-type="video/mp4" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.webm" --content-type="video/webm" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.docx" --content-type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
- aws s3 cp --exclude "*" --include "*.pdf" --content-type="application/pdf" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
# invalidate entire CloudFront cache
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*";
only:
- master
- master