Skip to content

Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha… #1

Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha…

Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha… #1

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 "/*"