#!/usr/bin/env bash set -euo pipefail # One-command deploy script: # 1) Build production bundle locally # 2) Upload archive to server # 3) Extract into target directory and fix ownership SERVER_HOST="47.83.117.213" SERVER_USER="root" SERVER_PASSWORD='Bkr!Srv#Mt5@Xoh_9KpL2' REMOTE_ARCHIVE="/tmp/manager-service-font-dist.tar.gz" REMOTE_DIR="/usr/local/golden/manager-service/font" LOCAL_ARCHIVE="dist.tar.gz" if ! command -v expect >/dev/null 2>&1; then echo "Error: expect is required but not installed." exit 1 fi echo "==> Installing dependencies" npm install echo "==> Building production bundle" # Pin production API origin (Vite does not override env vars already set). export VITE_API_BASE="https://ad.jinclab.com" npm run build echo "==> Packaging dist/" COPYFILE_DISABLE=1 tar -czf "${LOCAL_ARCHIVE}" dist echo "==> Uploading package to server" expect < Deploying on remote server" expect < Verifying remote files" expect <