Skip to content

Commit

Permalink
updated deployment github action
Browse files Browse the repository at this point in the history
  • Loading branch information
gopibabu-tmhcc committed Oct 24, 2023
1 parent a1e20e3 commit bd66cd0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@

set -e

PM2_PATH=/root/.nvm/versions/node/v18.10.0/bin/pm2
NODE_PATH=/root/.nvm/versions/node/v18.10.0/bin/node
# PM2_PATH=/root/.nvm/versions/node/v18.10.0/bin/pm2
NPM_PATH=/root/.nvm/versions/node/v18.10.0/bin/npm

echo "Deployment started ..."

# Enter maintenance mode or return true
# if already is in maintenance mode
($PM2_PATH stop server.js --message 'The app is being (quickly!) updated. Please try again in a minute.') || true
($NODE_PATH $NPM_PATH run stop --message 'The app is being (quickly!) updated. Please try again in a minute.') || true

# Pull the latest version of the app
git fetch origin master
git reset --hard origin/master
git pull origin master

# Compile npm assets
$NPM_PATH install --omit=dev
$NODE_PATH $NPM_PATH install --omit=dev

# Exit maintenance mode
$PM2_PATH start server.js
$NODE_PATH $NPM_PATH run start

echo "Deployment finished!"

0 comments on commit bd66cd0

Please sign in to comment.