-
Notifications
You must be signed in to change notification settings - Fork 10
65 lines (55 loc) · 2.06 KB
/
FE-CI&CD.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
name: front-end CI & CD
on:
push:
branches: [main]
jobs:
build:
runs-on: [ubuntu-latest]
strategy:
matrix:
node-version: [16.13]
defaults:
run:
working-directory: ./client
steps:
- uses: actions/checkout@v2
- name: npm 모듈들을 캐싱합니다.
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- name: npm 으로 패키지 다운로드합니다.
run: npm install
- name: Github Repository Secrets로 환경변수를 전달합니다.
run: |
echo "REACT_APP_SERVER_URL=$REACT_APP_SERVER_URL" >> .env.production
env:
REACT_APP_SERVER_URL: ${{ secrets.REACT_APP_SERVER_URL }}
- name: Github Repository Secrets로 환경변수를 전달합니다.
run: |
echo "REACT_APP_SOCKET_SERVER_URL=$REACT_APP_SOCKET_SERVER_URL" >> .env.production
env:
REACT_APP_SOCKET_SERVER_URL: ${{ secrets.REACT_APP_SOCKET_SERVER_URL }}
- name: 리액트 파일을 빌드합니다.
run: npm run build
- name: 기존에 배포된 파일 삭제합니다.
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.STATIC_SERVER_HOST }}
username: ${{ secrets.STATIC_SERVER_USERNAME }}
password: ${{ secrets.STATIC_SERVER_PASSWORD }}
port: ${{ secrets.STATIC_SERVER_PORT }}
script: |
rm -rf /var/www/tadaktadak.com/html/*
- name: 빌드 된 파일 scp를 통해 배포합니다.
uses: appleboy/scp-action@master
with:
host: ${{ secrets.STATIC_SERVER_HOST }}
username: ${{ secrets.STATIC_SERVER_USERNAME }}
password: ${{ secrets.STATIC_SERVER_PASSWORD }}
port: ${{ secrets.STATIC_SERVER_PORT }}
source: './client/build/*'
target: '/var/www/tadaktadak.com/html'
strip_components: 2