File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ name : piplines for second brain node js backends
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : 📥 Checkout code
14+ uses : actions/checkout@v3
15+
16+ - name : 🔧 Setup Node.js
17+ uses : actions/setup-node@v3
18+ with :
19+ node-version : 18
20+
21+ - name : 📦 Install dependencies
22+ run : npm install
23+
24+ - name : 🏗️ Build the project
25+ run : npm run build
26+
27+ - name : 🔐 Setup SSH key
28+ run : |
29+ mkdir -p ~/.ssh
30+ echo "${{ secrets.VM_SSH_KEY }}" > ~/.ssh/id_rsa
31+ chmod 600 ~/.ssh/id_rsa
32+ ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts
33+
34+ - name : 🚀 Deploy and run on VM
35+ run : |
36+ ssh ubuntu@${{ secrets.VM_HOST }} "
37+ cd /home/ubuntu/second-brain &&
38+ git pull origin main &&
39+ npm install &&
40+ npm run build &&
41+ pm2 restart myapp || pm2 start dist/index.js --name myapp
42+ "
You can’t perform that action at this time.
0 commit comments