feat: github action 추가 #1
Workflow file for this run
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: Frontend CI/CD | |
on: | |
push: | |
branches: | |
- feature/deploy # main 브랜치 푸시 시 실행 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Repository 코드 체크아웃 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 2. Node.js 설정 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 # 프로젝트에 맞는 버전 선택 | |
# 3. Dependencies 설치 | |
- name: Install dependencies | |
run: yarn install | |
# 4. Vite 빌드 | |
- name: Build project | |
run: yarn build | |
# 5. AWS CLI 설치 | |
- name: Install AWS CLI | |
uses: aws-actions/configure-aws-cli@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
# 6. S3에 업로드 | |
- name: Deploy to S3 | |
run: | | |
aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete |