Initial commit
This commit is contained in:
22
deploy/deploy.sh
Normal file
22
deploy/deploy.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pull latest, rebuild, bounce the service. Works for both instances:
|
||||
# deploy.sh -> main (prod, /opt/ghostgrid, port 3000)
|
||||
# deploy.sh dev -> dev (stage, /opt/ghostgrid-dev, port 3001)
|
||||
set -euo pipefail
|
||||
|
||||
BRANCH="${1:-main}"
|
||||
case "$BRANCH" in
|
||||
main) DIR=/opt/ghostgrid; SVC=ghostgrid ;;
|
||||
dev) DIR=/opt/ghostgrid-dev; SVC=ghostgrid-dev ;;
|
||||
*) echo "usage: deploy.sh [main|dev]"; exit 1 ;;
|
||||
esac
|
||||
|
||||
cd "$DIR"
|
||||
git fetch --prune origin
|
||||
git checkout "$BRANCH"
|
||||
git pull --ff-only origin "$BRANCH"
|
||||
npm ci
|
||||
npm run build
|
||||
sudo systemctl restart "$SVC"
|
||||
echo "Deployed $BRANCH ($SVC). Status:"
|
||||
systemctl --no-pager status "$SVC" | head -n 5
|
||||
Reference in New Issue
Block a user