Created
January 22, 2019 18:03
-
-
Save tusharf5/53e7d00107c76650088ac8c9318b274f to your computer and use it in GitHub Desktop.
Deploy to S3 Bucket with Cloudfront Invalidation
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
#!/bin/sh | |
echo "[Deploy] Building" | |
yarn run build | |
echo "[Deploy] Changing Directory" | |
cd ./dist | |
echo "[Deploy] Current Directory: ${PWD}" | |
echo "[Deploy] Emptying existing bucket <bucket_name>" | |
aws s3 rm s3://<bucket_name> --recursive | |
echo "[Deploy] Uploading new files to <bucket_name>" | |
aws s3 cp . s3://<bucket_name>/ --recursive | |
echo "[Deploy] Creating Invalidation for <bucket_name>" | |
aws cloudfront create-invalidation --distribution-id <cloudfront_distribution_id> --paths "/*" | |
echo "[Deploy] https://<bucket_name> updated." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't forget to
chmod +x ./deploy.sh