-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (60 loc) · 2.03 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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