Merge pull request #219 from ShinYoung-Kim/develop #131
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
name: front dev deploy | |
on: | |
push: | |
branches: [ develop ] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: properties 파일 복사 | |
run: | | |
echo "${{ secrets.WEB_PROD_SECRET }}" | base64 --decode > src/secret.tsx | |
- name: Build | |
run: | | |
npm install --legacy-peer-deps | |
CI=false npm run build --legacy-peer-deps | |
ls -al | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }} | |
aws-region: ap-northeast-2 | |
# react 빌드한 /build를 s3로 업로드 | |
- name: Upload /build to S3 | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME}} | |
run: | | |
aws s3 cp --recursive --region ap-northeast-2 dist s3://$BUCKET_NAME | |
# cloudfront 캐시 삭제 | |
- name: Invalidate CloudFront cache | |
env: | |
DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} | |
run: | | |
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" |