File tree Expand file tree Collapse file tree 1 file changed +28
-10
lines changed
Expand file tree Collapse file tree 1 file changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -569,16 +569,34 @@ deploy_s3bucket() {
569569 exit 1
570570 fi
571571
572- S3_OPTIONS=" --exclude '*' --include '*.txt' --include '*.js' --include '*.css' --content-encoding gzip"
573- echo aws s3 sync --dryrun $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
574- eval " aws s3 sync --dryrun $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} "
575- result=` eval " aws s3 sync $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} " `
576- if [ $? -eq 0 ]; then
577- echo " All txt, css, and js files are Deployed! with gzip"
578- else
579- echo " Deployment Failed - $result "
580- exit 1
581- fi
572+ # S3_OPTIONS="--exclude '*' --include '*.txt' --include '*.js' --include '*.css' --content-encoding gzip"
573+ searchpath=${AWS_S3_SOURCE_SYNC_PATH}
574+ lengthofsearchpath=$( echo ${# searchpath} )
575+ lengthofsearchpath=$(( lengthofsearchpath+ 1 ))
576+ for syncfilepath in $( find ${searchpath} -name ' *.js' -o -name ' *.txt' -o -name ' *.css' ) ;
577+ do
578+ echo " $syncfilepath "
579+ uploadpath=$( echo $syncfilepath | cut -b ${lengthofsearchpath} -)
580+ echo $uploadpath
581+ getformatdetails=$( file ${syncfilepath} )
582+ if [[ $getformatdetails == * " ASCII" * ]] || [[ $getformatdetails == * " empty" * ]];
583+ then
584+ echo " file format is ASCII and skipping gzip option"
585+ S3_OPTIONS=" "
586+ else
587+ echo $getformatdetails
588+ S3_OPTIONS=" --content-encoding gzip"
589+ fi
590+ echo aws s3 cp --dryrun $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
591+ eval " aws s3 cp --dryrun $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} "
592+ result=` eval " aws s3 cp $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS} " `
593+ if [ $? -eq 0 ]; then
594+ echo " file Deployed!"
595+ else
596+ echo " Deployment Failed - $result "
597+ exit 1
598+ fi
599+ done ;
582600}
583601download_envfile ()
584602{
You can’t perform that action at this time.
0 commit comments