Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Last active May 9, 2021 20:17
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benjamincharity/c8cc84249c90cd785dee60d9042ffef3 to your computer and use it in GitHub Desktop.
Save benjamincharity/c8cc84249c90cd785dee60d9042ffef3 to your computer and use it in GitHub Desktop.
Set up TravisCI to sync an S3 bucket.
" Two env variables must be added to TravisCI settings:
" AWS_SECRET_ACCESS_KEY
" AWS_ACCESS_KEY_ID
before_deploy:
pip install --user awscli
deploy:
provider: script
script: ~/.local/bin/aws s3 sync dist s3://MY_BUCKET_NAME --region=us-west-2 --delete
skip_cleanup: true
@astrotim
Copy link

Thanks for the gist. I'm using this with the --cache-control option.

script: ~/.local/bin/aws s3 sync dist s3://MY_BUCKET_NAME --region=us-west-2 --delete --cache-control="max-age=31536000"

I'm trying to find docs on how to set the cache-control only for specific file types, such as everything except .html files. Do you know how to achieve this?

@caub
Copy link

caub commented Jun 27, 2017

@astrotim put the files in 2 different folders, then sync each folder with different options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment