This commit is contained in:
@@ -22,6 +22,12 @@ jobs:
|
||||
set -euo pipefail
|
||||
APP_DIR=/opt/Train-ID
|
||||
SERVICE=train-id
|
||||
NODE=/home/deployuser/.nvm/versions/node/v22.21.0/bin/node
|
||||
NPM=/home/deployuser/.nvm/versions/node/v22.21.0/bin/npm
|
||||
if [ ! -x "$NODE" ] || [ ! -x "$NPM" ]; then
|
||||
echo "Expected NVM-managed node/npm not found at $NODE / $NPM" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$APP_DIR" ]; then
|
||||
sudo mkdir -p "$APP_DIR"
|
||||
sudo chown "$USER":"$USER" "$APP_DIR"
|
||||
@@ -30,8 +36,8 @@ jobs:
|
||||
cd "$APP_DIR"
|
||||
git pull origin main
|
||||
# Install Node.js deps and build
|
||||
npm ci || npm install
|
||||
npm run build
|
||||
"$NPM" ci || "$NPM" install
|
||||
"$NPM" run build
|
||||
# Ensure systemd service exists and restart
|
||||
if systemctl list-unit-files | grep -q "${SERVICE}.service"; then
|
||||
sudo systemctl restart "$SERVICE"
|
||||
|
||||
Reference in New Issue
Block a user