Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] Frontend CD 환경 재구축 #870

Open
wants to merge 4 commits into
base: fe-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/frontend-dev-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: frontend-dev-deploy

on:
push:
branches: ["fe-dev"]
paths:
- "client/**"

jobs:
deploy:
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./client

steps:
# 1. Git 리포지토리 체크아웃
- name: Checkout code
uses: actions/checkout@v4

# 2. Node.js 20.15.1 version으로 셋팅
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.15.1"

# 3. 의존성 설치
- name: Install Dependencies
run: npm install

# 4. Dev 환경으로 빌드
- name: Build for Dev environment
run: npm run build-dev
env:
API_BASE_URL: ${{ secrets.API_BASE_URL }}
AMPLITUDE_KEY: ${{ secrets.AMPLITUDE_KEY }}
KAKAO_JAVASCRIPT_KEY: ${{ secrets.KAKAO_JAVASCRIPT_KEY }}
IMAGE_URL: ${{ secrets.IMAGE_URL }}
KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

# 5. AWS 인증 설정
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
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: Upload build results to S3
run: aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }}/dev/ --delete

# 7. CloudFront 캐시 무효화
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.DEV_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"
61 changes: 61 additions & 0 deletions .github/workflows/frontend-prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: frontend-prod-deploy

on:
push:
branches: ["main"]
paths:
- "client/**"

jobs:
deploy:
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./client

steps:
# 1. Git 리포지토리 체크아웃
- name: Checkout code
uses: actions/checkout@v4

# 2. Node.js 20.15.1 version으로 셋팅
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.15.1"

# 3. 의존성 설치
- name: Install Dependencies
run: npm install

# 4. Prod 환경으로 빌드
- name: Build for Prod environment
run: npm run build
env:
API_BASE_URL: ${{ secrets.API_BASE_URL }}
AMPLITUDE_KEY: ${{ secrets.AMPLITUDE_KEY }}
KAKAO_JAVASCRIPT_KEY: ${{ secrets.KAKAO_JAVASCRIPT_KEY }}
IMAGE_URL: ${{ secrets.IMAGE_URL }}
KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

# 5. AWS 인증 설정
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
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: Upload build results to S3
run: aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }}/prod/ --delete

# 7. CloudFront 캐시 무효화
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.PROD_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"