summaryrefslogtreecommitdiff
path: root/scripts/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/deploy.sh')
-rwxr-xr-xscripts/deploy.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index 8269baf..04d551b 100755
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -4,6 +4,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
GARDEN_DIR="$PROJECT_ROOT/garden"
+DIST_DIR="$GARDEN_DIR/dist"
ENV_FILE="$PROJECT_ROOT/.env"
API_BASE="https://nekoweb.org/api"
@@ -36,6 +37,16 @@ fi
SITE_FOLDER="/${NEKOWEB_SITE}.nekoweb.org"
+log "Building garden..."
+cd "$GARDEN_DIR" && npm run build
+cd "$PROJECT_ROOT"
+
+if [ ! -d "$DIST_DIR" ]; then
+ error "Build failed: dist/ not found"
+fi
+
+echo ""
+
api_post() {
local endpoint="$1"
shift
@@ -100,7 +111,7 @@ upload_file() {
log "Starting deployment to nekoweb..."
log "Site: ${NEKOWEB_SITE}.nekoweb.org"
-log "Source: $GARDEN_DIR"
+log "Source: $DIST_DIR"
echo ""
log "Cleaning root..."
@@ -125,7 +136,7 @@ declare -a dirs_to_create=()
declare -a files_to_upload=()
while IFS= read -r -d '' file; do
- rel_path="${file#$GARDEN_DIR/}"
+ rel_path="${file#$DIST_DIR/}"
if [[ "$rel_path" == .* ]]; then
continue
@@ -140,7 +151,7 @@ while IFS= read -r -d '' file; do
fi
files_to_upload+=("$file|$remote_dir")
fi
-done < <(find "$GARDEN_DIR" -mindepth 1 -print0 | sort -z)
+done < <(find "$DIST_DIR" -mindepth 1 -print0 | sort -z)
if [ ${#dirs_to_create[@]} -gt 0 ]; then
log "Creating ${#dirs_to_create[@]} directories..."