Update deploy scripts to work with Vite dist dir (vs. build dir)

This commit is contained in:
2026-01-08 16:57:18 +00:00
parent 3ebd7ea251
commit bd5bb647b2
3 changed files with 40 additions and 3 deletions

9
scripts/build-and-deploy.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${REPO_ROOT}"
npm run build && bash "${SCRIPT_DIR}/deploy.sh"

View File

@@ -2,10 +2,10 @@
$remoteHost = "11001001.org"
# $remotePort = 22
$remoteDir = "/var/www/med-plan-assistant"
$localBuild = Join-Path $PSScriptRoot "..\build"
$localDist = Join-Path $PSScriptRoot "..\dist"
# Using pscp (PuTTY) with Pageant:
# & "C:\Program Files\PuTTY\pscp.exe" -r -P $remotePort $localBuild\* `
# & "C:\Program Files\PuTTY\pscp.exe" -r -P $remotePort $localDist\* `
# "$remoteUser@${remoteHost}:$remoteDir"
# Example SSH config entry:
@@ -15,5 +15,5 @@ $localBuild = Join-Path $PSScriptRoot "..\build"
# Port 22
# Using pscp (PuTTY) with Pageant and ssh config:
& "C:\Program Files\PuTTY\pscp.exe" -r $localBuild\* `
& "C:\Program Files\PuTTY\pscp.exe" -r $localDist\* `
"${remoteHost}:$remoteDir"

28
scripts/deploy.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
# remoteUser="username"
remoteHost="11001001.org"
# remotePort=22
remoteDir="/var/www/med-plan-assistant"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
localDist="${SCRIPT_DIR}/../dist"
if [[ ! -d "${localDist}" ]]; then
echo "Dist folder not found: ${localDist}" >&2
exit 1
fi
dest="${remoteHost}:${remoteDir}"
if [[ -n "${remoteUser:-}" ]]; then
dest="${remoteUser}@${remoteHost}:${remoteDir}"
fi
scp_args=()
if [[ -n "${remotePort:-}" ]]; then
scp_args+=("-P" "${remotePort}")
fi
# Copy contents of dist directory to remote target
scp -r "${scp_args[@]}" "${localDist}/"* "${dest}"