11#! /usr/bin/env bash
2- set -x
2+
33ENV=$1
44
55if [ " $2 " = " no-cache" ]; then
@@ -26,21 +26,30 @@ deploy_s3bucket() {
2626 S3_CACHE_OPTIONS=" --cache-control max-age=0,s-maxage=86400"
2727 fi
2828
29- S3_OPTIONS=" --exclude \" *.txt\" --exclude \" *.js\" --exclude \" *.css\" "
30- echo aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
31- aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
32- result=` aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} `
29+ S3_OPTIONS=' --exclude "*.txt" --exclude "*.js" --exclude "*.css"'
30+ S3_OPTIONS=(
31+ --exclude \" * .txt\"
32+ --exclude \" * .js\"
33+ --exclude \" * .css\" )
34+ echo aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]}
35+ aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]}
36+ result=` aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]} `
3337 if [ $? -eq 0 ]; then
3438 echo " All html, font, image, map and media files are Deployed without gzip encoding!"
3539 else
3640 echo " Deployment Failed - $result "
3741 exit 1
3842 fi
3943
40- S3_OPTIONS=" --exclude \" *\" --include \" *.txt\" --include \" *.js\" --include \" *.css\" --content-encoding gzip"
41- echo aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
42- aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
43- result=` aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} `
44+ S3_OPTIONS=(
45+ --exclude \" * \"
46+ --include \" * .txt\"
47+ --include \" * .js\"
48+ --include \" * .css\"
49+ --content-encoding gzip)
50+ echo aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]}
51+ aws s3 sync --dryrun ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]}
52+ result=$( aws s3 sync ${HOME} /${CIRCLE_PROJECT_REPONAME} /dist s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS[@]} )
4453 if [ $? -eq 0 ]; then
4554 echo " All txt, css, and js files are Deployed! with gzip"
4655 else
0 commit comments