Update NVM
Some checks failed
Deploy to Server / deploy (push) Failing after 4s

This commit is contained in:
2025-10-25 18:15:24 -04:00
parent d8f3edb9fe
commit 50fc402594

View File

@@ -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"