-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.93 KB
/
CodeDeploy.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
name: Deploy to S3 and Invalidate CloudFront
on:
push:
branches:
- main # 또는 배포할 브랜치 이름
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: create env file
run: |
touch .env
echo VITE_API_ENDPOINT=${{secrets.VITE_API_ENDPOINT}} >> .env
echo VITE_CLIENT_ID=${{secrets.VITE_CLIENT_ID}} >> .env
echo VITE_CLIENT_SECRET=${{secrets.VITE_CLIENT_SECRET}} >> .env
echo VITE_REDIRECT_URL=${{secrets.VITE_REDIRECT_URL}} >> .env
echo VITE_KAKAO_CLIENT_ID=${{secrets.VITE_KAKAO_CLIENT_ID}} >> .env
echo VITE_KAKAO_CLIENT_SECRET_KEY=${{secrets.VITE_KAKAO_CLIENT_SECRET_KEY}} >> .env
echo VITE_GOOGLE_CLIENT_ID=${{secrets.VITE_GOOGLE_CLIENT_ID}} >> .env
echo VITE_GOOGLE_CLIENT_SECRET_KEY=${{secrets.VITE_GOOGLE_CLIENT_SECRET_KEY}} >> .env
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Deploy to S3
uses: jakejarvis/[email protected]
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}
AWS_REGION: 'ap-northeast-2'
SOURCE_DIR: 'dist' # React 빌드 결과물 디렉터리
- name: Invalidate CloudFront
uses: chetan/[email protected]
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_ID }}
PATHS: '/*'
AWS_REGION: 'ap-northeast-2'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}