Skip to content

Merge pull request #42 from 100-hours-a-week/Yeonsu00-12-patch-2 #13

Merge pull request #42 from 100-hours-a-week/Yeonsu00-12-patch-2

Merge pull request #42 from 100-hours-a-week/Yeonsu00-12-patch-2 #13

Workflow file for this run

name: Deploy Frontend by Cloudfront
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Deploy to S3
run: aws s3 sync build s3://ustock-bucket/react/ --delete
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/react/*" "/react/static/js/*" "/react/static/css/*" "/react/static/media/*"