Merge pull request #170 from softeerbootcamp4th/feat/#168/MiniQuizRes… #79
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 and CloudFront | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install AWS CLI | |
run: sudo apt-get install -y awscli | |
- name: Install Dependencies | |
run: yarn install | |
working-directory: ./service | |
- name: Build Project | |
run: yarn build | |
working-directory: ./service | |
env: | |
VITE_API_URL: ${{ secrets.API_URL }} | |
- name: Sync S3 | |
uses: jakejarvis/[email protected] | |
with: | |
args: --acl public-read --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: "./service/dist" # 빌드된 파일들이 위치한 디렉토리 | |
- name: Invalidate CloudFront Cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" | |
env: | |
AWS_REGION: "ap-northeast-2" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |