-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (47 loc) · 1.26 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
52
53
54
55
56
57
58
59
60
name: NestJS CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
deploy:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
bash -c '
export PATH=$PATH:/root/.nvm/versions/node/v22.12.0/bin/
cd /home/project/test-nest-snapp/SnappFood-Nestjs
git pull
npm install
npm run build
pm2 start npm --name "nest-server" -- run start
'