Skip to content

Commit

Permalink
script added (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
Prybrt06 authored Jan 27, 2024
1 parent 8f25516 commit 136f5fd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

echo "Pulling from git..."
git pull origin dev
echo "Installing dependencies..."
pnpm install
echo "Migrating database..."
pnpm prisma db push
echo "Generating prisma client..."
pnpm prisma generate
echo "Building..."
pnpm run build

PROCESS_NAME="server-dev"

echo "Checking if $PROCESS_NAME is running..."
if pm2 show $PROCESS_NAME &>/dev/null; then
# If the process exists, restart it
echo "Restarting $PROCESS_NAME..."
pm2 restart $PROCESS_NAME
else
# If the process doesn't exist, start it
echo "Starting $PROCESS_NAME..."
pm2 start ./dist/server.js --name $PROCESS_NAME
fi

0 comments on commit 136f5fd

Please sign in to comment.