Skip to content

Instantly share code, notes, and snippets.

@mhazy
Last active August 29, 2017 14:34
Show Gist options
  • Save mhazy/b5bdd8a36de725fd3c4e to your computer and use it in GitHub Desktop.
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
# 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