Prod CD #24
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: Prod CD # Workflow 이름 | |
on: # Event 감지 | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: # Job 설정 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code. # Repo checkout | |
uses: actions/checkout@v2 | |
- name: Check Node v # Node v 확인 | |
run: node -v | |
- name: Add GH Secrets into .env file | |
run: echo "REACT_APP_KAKAO_JAVASCRIPT_KEY=$KAKAO_JAVASCRIPT_KEY" >> .env | |
env: | |
KAKAO_JAVASCRIPT_KEY: ${{ secrets.KAKAO_JAVASCRIPT_KEY }} | |
- name: Install Dependencies # 의존 파일 설치 | |
run: yarn install --frozen-lockfile | |
- name: Build # React Build | |
run: yarn build | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Upload To S3 | |
run: aws s3 sync --delete build s3://petition-bucket/prod | |
- name: Invalidate CloudFront Cache | |
run: aws cloudfront create-invalidation --distribution-id E18QP4Q8ZHLODO --paths "/*" |