-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (27 loc) · 904 Bytes
/
Copy pathcd.yml
File metadata and controls
30 lines (27 loc) · 904 Bytes
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
name: Node.js CD
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Deploy using ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: 22
script: |
echo "Changing to app directory..."
cd ci-cd || exit 1
echo "Pulling latest code from master branch..."
git pull origin master || exit 1
echo "Checking git status..."
git status
echo "Installing production dependencies..."
npm install --only=prod || exit 1
echo "Restarting application using PM2..."
sudo pm2 restart index || exit 1
echo "Deployment complete."