Merge pull request #168 from prgrms-web-devcourse-final-project/feat/… #5
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: Deploy To S3 | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Repository 파일 불러오기 | |
uses: actions/checkout@v4 | |
- name: Node.js 설정 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Vite 설치 | |
run: npm install -g vite | |
- name: 의존성 설치 | |
run: npm ci | |
- name: 프로젝트 빌드 | |
env: | |
VITE_MAP_API_KEY: ${{ secrets.VITE_MAP_API_KEY }} | |
VITE_API_ENDPOINT: ${{ secrets.VITE_API_ENDPOINT }} | |
VITE_TOKEN: ${{ secrets.VITE_TOKEN }} | |
run: vite build | |
- name: AWS Resource에 접근할 수 있게 AWS credentials 설정 | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ap-northeast-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: S3 기존 파일들 전체 삭제 후 새로 업로드 | |
run: | | |
aws s3 rm --recursive s3://catchmi-web-page | |
aws s3 cp ./dist s3://catchmi-web-page/ --recursive | |
- name: Cloudfront 캐시 무효화 | |
run: aws cloudfront create-invalidation --distribution-id E27N31R2646KQX --paths "/*" |