I'm trying something for the first time with github action. I wrote a working system when I pushed anything. It successfully executes git pull and npm commands, but when I say pm2 restart app it gives an error like this.
err: [PM2][ERROR] Process or Namespace app not found
When I enter the server with terminal and make pm2 restart app it works successfully. The problem is only when I do it with github action.
My .yml file
name: Node.js CI
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Push to server
uses: appleboy/ssh-action@master
with:
host: xxxx
username: xxxx
password:xxxx
script: cd /root/www && npm run deploy && pm2 restart app