-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (39 loc) · 1.36 KB
/
frontend-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
name: Frontend CD
on:
push:
branches:
- main
jobs:
deploy:
name: React Build & Push To NCP Server
runs-on: ubuntu-latest
steps:
- name: Repository를 가져온다
uses: actions/checkout@v3
- name: Github Action Secrets에 등록된 정보들을 가져온다
env:
ENV_VALUE: ${{ secrets.ENV_VALUE }}
run: echo $ENV_VALUE | base64 --decode > .env
- name: npm install을 진행한다
run: npm install -f
- name: React Build를 진행한다
run: CI=false npm run build
- name: NCP Server로 빌드 파일을 전송한다
uses: appleboy/scp-action@master
with:
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
source: "./build"
target: "/app"
- name: NCP Server에 SSH 접속 후 빌드 파일을 Nginx로 옮긴다
uses: appleboy/ssh-action@master
with:
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo rm -rf /usr/share/nginx/html/*
sudo mv /app/build/* /usr/share/nginx/html/