Files
website/deploy.sh
T

44 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Deploy the Inference Cooperative landing page to Cloudron Surfer.
#
# Uses `cloudron exec` to write files directly into Surfer's /app/data/public
# directory — no WebDAV token or SSH required. Auth is the Cloudron CLI token
# (read from env as CLOUDRON_TOKEN, the same token the CLI uses everywhere else).
#
# Usage:
# CLOUDRON_TOKEN=... ./deploy.sh
#
# The script uploads the repo's site assets (index.html, favicon.svg, fonts/,
# thanks/, and the static assets) to the Surfer instance.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
: "${CLOUDRON_TOKEN:?CLOUDRON_TOKEN is required (the Cloudron API token)}"
SERVER="${CLOUDRON_SERVER:-my.inference.coop}"
APP="${SURFER_APP:-inference.coop}" # Surfer app location
# Files that make up the live site, mirrored in /app/data/public/.
SITE_FILES=(
index.html
favicon.svg
robots.txt
sitemap.xml
metagov-earth.png
inference-card.png
fonts
thanks
)
echo "Deploying to $SERVER ($APP) via cloudron exec"
# Tar the site files and extract into Surfer's public dir on the server.
# cloudron exec is not a TTY, so `tar -x` works over the stdin pipe.
tar cf - "${SITE_FILES[@]}" | \
cloudron --server "$SERVER" --token "$CLOUDRON_TOKEN" exec --app "$APP" -- \
sh -c 'tar xf - -C /app/data/public'
echo "Deploy complete."