diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 2b425e5..c0b9d45 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -11,7 +11,30 @@ source "$ROOT_DIR/scripts/config.sh" git push origin main # SSH to target and update -ssh "$HOST" "cd $DEST && git pull origin main && bun run build && sudo systemctl restart toes.service" +ssh "$HOST" "cd $DEST && git pull origin main && bun run build" + +# Sync default apps/tools from repo to APPS_DIR +echo "=> Syncing default apps..." +ssh "$HOST" bash -s "$DEST" "$APPS_DIR" <<'SCRIPT' +DEST="$1" +APPS_DIR="$2" +for app_dir in "$DEST"/apps/*/; do + app=$(basename "$app_dir") + for version_dir in "$app_dir"*/; do + [ -d "$version_dir" ] || continue + version=$(basename "$version_dir") + [ -f "$version_dir/package.json" ] || continue + target="$APPS_DIR/$app/$version" + mkdir -p "$target" + cp -a "$version_dir"/. "$target"/ + rm -f "$APPS_DIR/$app/current" + echo " $app/$version" + (cd "$target" && bun install --frozen-lockfile 2>/dev/null || bun install) + done +done +SCRIPT + +ssh "$HOST" "sudo systemctl restart toes.service" echo "=> Deployed to $HOST" echo "=> Visit $URL"