Update CI workflow to enhance deployment command for application restart
CI / build (push) Has been skipped
CI / deploy (push) Successful in 45s

- Modified the deployment command in the CI workflow to use 'bash -lc' for improved execution context.
- Updated the pm2 restart logic to include the '--update-env' flag for better environment variable handling during application restarts.
This commit is contained in:
eewing
2026-02-17 10:11:25 -06:00
parent 77fccefd16
commit 3c4712b5ee
+1 -1
View File
@@ -90,4 +90,4 @@ jobs:
run: | run: |
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=accept-new -p ${{ secrets.DEPLOY_SSH_PORT || '22' }} \ sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=accept-new -p ${{ secrets.DEPLOY_SSH_PORT || '22' }} \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST || env.DEPLOY_HOST }} \ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST || env.DEPLOY_HOST }} \
"cd ${{ secrets.DEPLOY_PATH || env.DEPLOY_PATH }} && export PORT=${{ env.APP_PORT }} && (command -v pm2 &>/dev/null && (pm2 restart hrm 2>/dev/null || pm2 start build/index.js --name hrm) || true) || (sudo systemctl restart hrm 2>/dev/null) || (nohup node build > /var/log/hrm.log 2>&1 &)" 'bash -lc "cd ${{ secrets.DEPLOY_PATH || env.DEPLOY_PATH }} && export PORT=${{ env.APP_PORT }} && (pm2 restart hrm 2>/dev/null || pm2 start build/index.js --name hrm --update-env)"'