-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.4 KB
/
main.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
name: Deploy React App to Oracle Cloud
on:
push:
branches:
- main # main 브랜치에 push할 때마다 실행
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1. 리포지토리 클론
- name: Checkout repository
uses: actions/checkout@v2
# 2. Node.js 설치
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
# 3. 종속성 설치 (yarn 사용 시 변경 가능)
- name: Install dependencies
run: npm install
# 4. 애플리케이션 빌드
- name: Build the project
run: npm run build
# 5. Oracle Cloud A1 서버로 파일 전송
- name: Copy files via SSH
uses: appleboy/scp-action@v0.1.5
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
source: "build/"
target: "/home/ubuntu/tkFront/"
# 6. Oracle 서버에서 앱 실행 (서버에서 npm install을 이미 마쳤다고 가정)
- name: Run app on Oracle server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
script: |
exec bash \-l
cd /home/ubuntu/tkFront/build
serve -s . -l 3000