Update deploy scripts to work with Vite dist dir (vs. build dir)
This commit is contained in:
9
scripts/build-and-deploy.sh
Executable file
9
scripts/build-and-deploy.sh
Executable 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"
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
$remoteHost = "11001001.org"
|
$remoteHost = "11001001.org"
|
||||||
# $remotePort = 22
|
# $remotePort = 22
|
||||||
$remoteDir = "/var/www/med-plan-assistant"
|
$remoteDir = "/var/www/med-plan-assistant"
|
||||||
$localBuild = Join-Path $PSScriptRoot "..\build"
|
$localDist = Join-Path $PSScriptRoot "..\dist"
|
||||||
|
|
||||||
# Using pscp (PuTTY) with Pageant:
|
# 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"
|
# "$remoteUser@${remoteHost}:$remoteDir"
|
||||||
|
|
||||||
# Example SSH config entry:
|
# Example SSH config entry:
|
||||||
@@ -15,5 +15,5 @@ $localBuild = Join-Path $PSScriptRoot "..\build"
|
|||||||
# Port 22
|
# Port 22
|
||||||
|
|
||||||
# Using pscp (PuTTY) with Pageant and ssh config:
|
# 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"
|
"${remoteHost}:$remoteDir"
|
||||||
|
|||||||
28
scripts/deploy.sh
Executable file
28
scripts/deploy.sh
Executable 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}"
|
||||||
Reference in New Issue
Block a user