Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sw326/clean_front
Browse files Browse the repository at this point in the history
  • Loading branch information
sw326 committed Sep 14, 2024
2 parents d244d91 + c4f47e8 commit 85f38c4
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Frontend CI/CD

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}-new-key
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
run: npm ci
continue-on-error: false

- name: Run tests
run: npm test -- --passWithNoTests
continue-on-error: false

- name: Build project
run: npm run build
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_PARTNER_API_URL: ${{ secrets.VITE_PARTNER_API_URL }}
VITE_PUBLIC_API_URL: https://api.odcloud.kr/api/nts-businessman/v1/status
VITE_PUBLIC_API_KEY: ${{ secrets.VITE_PUBLIC_API_KEY }}
VITE_KAKAO_REST_API_KEY: ${{ secrets.VITE_KAKAO_REST_API_KEY }}
VITE_KAKAO_REDIRECT_URI: ${{ secrets.VITE_KAKAO_REDIRECT_URI }}
VITE_IMP_KEY: ${{ secrets.VITE_IMP_KEY }}
continue-on-error: false

- name: Build project
run: npm run build
env:
VITE_API_URL_MEMBER: ${{ secrets.API_URL_MEMBER }}
VITE_API_URL_PARTNER: ${{ secrets.API_URL_PARTNER }}
continue-on-error: false

- 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 dist/ s3://${{ secrets.S3_BUCKET }} --delete
continue-on-error: false

- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
continue-on-error: false

0 comments on commit 85f38c4

Please sign in to comment.