Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Merge branch 'feature/timetable' into merge-test #37

Merge branch 'feature/timetable' into merge-test

Merge branch 'feature/timetable' into merge-test #37

Workflow file for this run

name: Deploy Frontend to S3
on:
push:
branches: ['merge-test'] # 1. 이 브랜치 이름을 'main' 등 실제 사용하는 브랜치로 변경하세요.
release:
types: ['published']
jobs:
build-and-deploy-to-s3:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# 2. Node.js LTS 20.x 버전으로 설정
- name: Set up Node.js LTS
uses: actions/setup-node@v4
with:
node-version: '20.x' # LTS 버전 명시
cache: 'npm'
# 3. 의존성 설치 및 프로젝트 빌드
- name: Install dependencies
run: npm ci # package-lock.json을 사용해 빠르게 설치
- name: Build project
run: npm run build
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }} # 백엔드 주입
# 4. AWS 자격 증명 설정
- 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 # S3 버킷이 있는 리전
# 5. S3 버킷으로 빌드 결과물 업로드 (Sync)
# 빌드 폴더가 './dist'가 아니라면 (예: './build') 경로 수정
- name: Sync build folder to S3
run: |
aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete
# 6. (필수) CloudFront 캐시 무효화
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} \
--paths "/*"