Created
February 28, 2017 09:54
-
-
Save vinhlh/9471cba9772c64359bd26e1525e5961c to your computer and use it in GitHub Desktop.
Multiple deployments to multiple S3 buckets and single and final hook
This file contains 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
language: node_js | |
node_js: | |
- 6 | |
cache: | |
directories: | |
- dir_1/node_modules | |
before_install: | |
- cd dir_1 | |
install: | |
# for invalidating CloudFront distribution | |
- pip install --user awscli | |
- npm install | |
script: | |
- gulp | |
- cd - # back to main directory | |
deploy: | |
# access, secret keys, region are configured in TravisCI backend | |
- provider: s3 | |
access_key_id: $AWS_ACCESS_KEY_ID | |
secret_access_key: $AWS_SECRET_ACCESS_KEY | |
region: $AWS_DEFAULT_REGION | |
bucket: $AWS_S3_STATIC_BUCKET_NAME | |
skip_cleanup: true | |
local_dir: dir_1/dist | |
on: | |
branch: master | |
- provider: s3 | |
access_key_id: $AWS_ACCESS_KEY_ID | |
secret_access_key: $AWS_SECRET_ACCESS_KEY | |
region: $AWS_DEFAULT_REGION | |
bucket: $AWS_S3_WORLDWIDE_BUCKET_NAME | |
skip_cleanup: true | |
local_dir: dir_2 | |
on: | |
branch: master | |
after_script: | |
# allow `awscli` to make requests to CloudFront. | |
- aws configure set preview.cloudfront true | |
# invalidate all objects in the CloudFront distributions | |
- aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_1_DISTRIBUTION_ID --paths "/*" | |
- aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_2_DISTRIBUTION_ID --paths "/*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment