Last active
August 29, 2017 14:34
-
-
Save mhazy/b5bdd8a36de725fd3c4e to your computer and use it in GitHub Desktop.
CodeShip deployment script for syncing build to S3 and setting per-file cache settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure awscli is installed | |
pip install awscli | |
# build | |
grunt build-staging | |
# Clear staging path on s3 | |
aws s3 rm s3://[BUCKET NAME]/[DIRECTORY] --recursive | |
# Sync the dist folder | |
aws s3 sync ./dist s3://[BUCKET NAME]/[DIRECTORY] --acl public-read --cache-control "public, max-age=86400" | |
# Update index.html to have a 60sec cache | |
aws s3api copy-object --copy-source [BUCKET NAME]/[FILEPATH] --cache-control "public, max-age=60" --content-type "text/html" --bucket [BUCKET NAME] --key [FILEPATH] --metadata-directive="REPLACE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment