Last active
January 27, 2020 14:50
-
-
Save WoonHaKim/6023db2ea44fcf1760fd6f557767c6ca to your computer and use it in GitHub Desktop.
exampleDist.sh
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/bash | |
# .env의 위치 | |
export ENV_FILE=ENVIRONMENT_FILE_HERE | |
# build가 끝난 폴더의 위치 (ex. ./dist) | |
export BUILD_FOLDER=BUILD_FOLDER_HERE | |
# s3 bucket 및 폴더의 위치 | |
export S3_BUCKET_DESTINATION=s3://bucket_name/destination | |
# Invalidate 할 폴더의 위치 | |
export CDN_DISTRIBUTION_ID=CLOUDFRONT_DIST_HERE | |
# CDN Invalidation Path | |
export CDN_INVALIDATION_PATH="/*" | |
# 아래의 내용을 $ENV_FILE에 씁니다. (echo로 출력 한 내용을 $ENV_FILE로 내보냄) | |
echo " | |
export const someEnv='someEnv' | |
" > $ENV_FILE | |
# 전체 라이브러리를 Build 함 | |
npm install | |
npm run build | |
# AWS CLI를 이용하여 S3 Upload 수행 | |
aws s3 sync $BUILD_FOLDER $S3_BUCKET_DESTINATION | |
# AWS CLI를 이용하여 CLOUDFRONT Invalidation 수행 | |
aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths $CDN_INVALIDATION_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment