-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeploy.sh
More file actions
31 lines (26 loc) · 1.32 KB
/
Copy pathdeploy.sh
File metadata and controls
31 lines (26 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# Example helper: build coredrive-rx and upload dist/ to a static host over SSH.
# This is OPTIONAL — host the built static files however you like (any HTTPS web
# server). Configure via env vars; nothing here is deployment-specific.
#
# RX_DEPLOY_HOST user@host of the web server (required)
# RX_DEPLOY_DEST absolute path of the served dir on the server (required)
# RX_DEPLOY_KEY SSH private key (optional; default: ssh-agent / ~/.ssh/id_*)
#
# NOTE: this uploads dist/ only. It does NOT touch the server's config.json —
# that file is owned by the sysop and lives on the host next to index.html.
set -euo pipefail
HOST="${RX_DEPLOY_HOST:?set RX_DEPLOY_HOST=user@host}"
DEST="${RX_DEPLOY_DEST:?set RX_DEPLOY_DEST to the absolute path on the server}"
KEY="${RX_DEPLOY_KEY:-}"
SSH_OPTS=(-o StrictHostKeyChecking=accept-new)
[ -n "$KEY" ] && SSH_OPTS+=(-i "$KEY")
echo "[rx] building..."
npm run build
# Never ship a config.json: the sysop owns it on the server (next to index.html).
# A local public/config.json (used for `npm run dev`) is copied into dist/ by Vite,
# so drop it here to avoid overwriting the server's real config on upload.
rm -f dist/config.json
echo "[rx] uploading dist/ -> $HOST:$DEST (server config.json left untouched) ..."
scp "${SSH_OPTS[@]}" -r dist/. "$HOST:$DEST"
echo "[rx] done."