Skip to content

Code deployment method has changed for cludfront #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions master_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,34 @@ deploy_s3bucket() {
exit 1
fi

S3_OPTIONS="--exclude '*' --include '*.txt' --include '*.js' --include '*.css' --content-encoding gzip"
echo aws s3 sync --dryrun $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
eval "aws s3 sync --dryrun $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}"
result=`eval "aws s3 sync $AWS_S3_SOURCE_SYNC_PATH s3://${AWS_S3_BUCKET} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}"`
if [ $? -eq 0 ]; then
echo "All txt, css, and js files are Deployed! with gzip"
else
echo "Deployment Failed - $result"
exit 1
fi
# S3_OPTIONS="--exclude '*' --include '*.txt' --include '*.js' --include '*.css' --content-encoding gzip"
searchpath=${AWS_S3_SOURCE_SYNC_PATH}
lengthofsearchpath=$(echo ${#searchpath})
lengthofsearchpath=$((lengthofsearchpath+1))
for syncfilepath in $(find ${searchpath} -name '*.js' -o -name '*.txt' -o -name '*.css');
do
echo "$syncfilepath"
uploadpath=$(echo $syncfilepath | cut -b ${lengthofsearchpath}-)
echo $uploadpath
getformatdetails=$(file ${syncfilepath})
if [[ $getformatdetails == *"ASCII"* ]] || [[ $getformatdetails == *"empty"* ]];
then
echo "file format is ASCII and skipping gzip option"
S3_OPTIONS=""
else
echo $getformatdetails
S3_OPTIONS="--content-encoding gzip"
fi
echo aws s3 cp --dryrun $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}
eval "aws s3 cp --dryrun $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}"
result=`eval "aws s3 cp $syncfilepath s3://${AWS_S3_BUCKET}${uploadpath} ${S3_CACHE_OPTIONS} ${S3_OPTIONS}"`
if [ $? -eq 0 ]; then
echo "file Deployed!"
else
echo "Deployment Failed - $result"
exit 1
fi
done;
}
download_envfile()
{
Expand Down