29 lines
650 B
Bash
Executable File
29 lines
650 B
Bash
Executable File
#!/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}"
|