-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (53 loc) ยท 2.14 KB
/
FrontendDeploy.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
name: Frontend Deploy
on:
push:
branches:
- main
paths:
- 'front/**'
jobs:
frontend:
name: Frontend CICD
runs-on: ubuntu-latest
env:
working-directory: ./front
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Check Node V #virtual ํ๊ฒฝ์ node ์ด๋ฏธ ์ค์น๋์ด ์์. yarn, npm, AWS CLI๋ ๋ง์ฐฌ๊ฐ์ง
run: node -v
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key:
${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: #์ผ์นํ๋ ์บ์ key๊ฐ ์์ ๋ ์ฐจ์ ํ์ผ๋ก ์บ์ฑํด๋๋ฅผ ์ฐพ๋๋ค.
${{ runner.OS }}-build- ${{ runner.OS }}-
- name: Install Dependencies
run: npm install
working-directory: ${{ env.working-directory }}
- name: Code Build
run: npm run build
working-directory: ${{ env.working-directory }}
- name: Configure AWS credentials #์ฌ์ฉ์ ์ธ์ฆ
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_FRONT }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FRONT }}
aws-region: ap-northeast-2
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_FRONT }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_FRONT }}
run: aws s3 cp --recursive --region ap-northeast-2 build
s3://yetsul.com #ํ์ผ์ด ์๋ ํด๋ ์
๋ก๋ ์์ --recursive ํ์
working-directory: ${{ env.working-directory }}
- name: build result to slack #์ฌ๋ ๋ฉ์์ง ์ถ๋ ฅ
uses: 8398a7/action-slack@v3
with:
status: ${{job.status}}
fields: repo,message,commit,author,eventName,ref,workflow
author_name: Frontend CI/CD
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}