forked from kanghonggu/ccxt
-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (45 loc) · 1.86 KB
/
ci.yml
File metadata and controls
52 lines (45 loc) · 1.86 KB
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: Node.js CICD
concurrency:
group: production
cancel-in-progress: true
#동시성 설정, 배포 workflow이기에, 여러개의 workflow가 실행될 때 마지막 workflow만 남기고 모두 취소
on:
push:
branches: [main]
pull_request:
branches: [main]
##workflow_dispatch:
#main Branch에 push(PR을 통해서 Merge되는 경우와 직접 push 한 경우)
#직접 github에서 트리깅하는 경우(서버에 이슈가 발생한 경우 수동으로 재시작하기 위함)
jobs:
build:
#
runs-on: [ self-hosted ]
# node-version 과 같이 배열로 돼있으면, 해당 원소를 순회하면서 작업이 반복해서 실행된다.
# 응용해서 runs-on에 여러 OS에서 돌릴 수도 있다.
strategy:
matrix:
node-version: [20.x] # 템플릿 기본값: [18.x,19.x,20.x]
# uses 개념은 다른 사람이 작성한 내용을 실행하는 개념이다.
# actions/checkout: GitHub의 마지막 커밋으로 Checkout 한다.
# actions/setup-node: Node.js를 설치한다.
#
steps:
- uses: actions/checkout@v4
with:
clean: false
#- name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# nodejs 20.10 서버에 설치되어 있으므로 주석 처리 함
# nodejs path : /usr/local/lib/nodejs/
# npm ci는 npm install과 같은 기능을 수행한다.
- run: npm install
# --if-present 옵션은 npm 스크립트가 존재할 때만 실행시키라는 의미이다.
# 만약 build 스크립트가 없는 경우, 오류 없이 지나간다.
- run: npm run test
- run: npm run build --if-present
- run: pm2 start "npm run start" --name ccxt
# - run: pm2 kill
# - run: pm2 reload dist/main.js --name ccxt