mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-23 12:57:58 +00:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1.3 KiB
Bash
32 lines
1.3 KiB
Bash
#!/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."
|