From 5c974e43d65b38ac1a7d40bab069b1a918251cb6 Mon Sep 17 00:00:00 2001 From: Jake Hall Date: Sat, 6 Jul 2024 07:16:08 +0100 Subject: [PATCH] update action to install modules on server and reload pm2 --- .github/workflows/prod-cicd.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prod-cicd.yml b/.github/workflows/prod-cicd.yml index e6e603f..0de355b 100644 --- a/.github/workflows/prod-cicd.yml +++ b/.github/workflows/prod-cicd.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - main + jobs: production: runs-on: ubuntu-latest @@ -25,7 +26,13 @@ jobs: chmod 600 ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa.pub ssh-keyscan -H ${{ secrets.SSH_IP }} >> ~/.ssh/known_hosts - - name: copy builds to server + - name: Copy builds to server + run: | + rsync -vrm dist package.json package-lock.json ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/var/www/test-api.gomint.me/ + - name: Install dependencies on server and reload pm2 run: | - rsync -vrm dist node_modules package.json package-lock.json ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/var/www/test-api.gomint.me/ - ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} "pm2 restart 0" + ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} << 'EOF' + cd /var/www/test-api.gomint.me/ + npm ci + pm2 reload 0 + EOF