Created
December 13, 2022 07:48
-
-
Save mahi424/7b6d266f7833c98d3eb8ddafff56530b to your computer and use it in GitHub Desktop.
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
#create build | |
npm run build | |
# Enable printing executed commands | |
set x | |
trap "exit" INT | |
# Get AWS PROFILE, S3 Bucket and CloudFront Id from environment variables or write it down statically | |
aws_profile=<aws_profile> | |
s3_bucket=<s3_bucket> | |
echo Profile: $aws_profile | |
echo S3_Bucket: $s3_bucket | |
if [ -z "$aws_profile" ]; then | |
echo AWS_PROFILE not found | |
exit | |
fi | |
if [ -z "$s3_bucket" ]; then | |
echo S3_BUCKET not found | |
exit | |
fi | |
#set env variable for aws cli | |
export AWS_PROFILE=$aws_profile | |
if [ ! -d "build" ]; then | |
echo "${red}Build folder not found${reset}" | |
exit 0; | |
fi | |
echo Synching Build Folder: $s3_bucket... | |
aws s3 sync build/ s3://$s3_bucket --delete --cache-control max-age=31536000,public |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment