Ryan Malloy e92b7f8700 Initial commit: TigerStyle Life9 v1.0.0
Because cats have 9 lives, but servers don't - so they need
backup-restore! Complete backup solution with S3/MinIO support.

- Full WordPress backup (files + database)
- S3 / MinIO / S3-compatible storage backends
- Scheduled automatic backups
- Disaster recovery / one-click restore
- Backup integrity validation
- Cat-themed admin interface

Includes build.sh and .distignore for WordPress-installable release ZIPs.
2026-05-27 14:32:00 -06:00

50 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build a clean WordPress-installable release ZIP for this plugin.
# Reads .distignore to decide what gets excluded.
# Usage: ./build.sh [version-override]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_SLUG="$(basename "$SCRIPT_DIR")"
MAIN_FILE="$SCRIPT_DIR/${PLUGIN_SLUG}.php"
OUT_DIR="$SCRIPT_DIR/build"
if [[ ! -f "$MAIN_FILE" ]]; then
echo "ERROR: main plugin file $MAIN_FILE not found" >&2
exit 1
fi
VERSION="${1:-$(grep -E "^\s*\*\s*Version:" "$MAIN_FILE" | head -1 | awk '{print $NF}')}"
if [[ -z "$VERSION" ]]; then
echo "ERROR: could not determine version" >&2
exit 1
fi
ZIP_NAME="${PLUGIN_SLUG}-${VERSION}.zip"
OUT_ZIP="$OUT_DIR/$ZIP_NAME"
STAGE="$(mktemp -d -t "${PLUGIN_SLUG}-build-XXXXXX")"
trap "rm -rf '$STAGE'" EXIT
echo "Building $PLUGIN_SLUG v$VERSION$OUT_ZIP"
EXCLUDE_ARGS=(--exclude='.git')
if [[ -f "$SCRIPT_DIR/.distignore" ]]; then
while IFS= read -r line; do
[[ "$line" =~ ^[[:space:]]*# ]] && continue
[[ -z "${line// }" ]] && continue
EXCLUDE_ARGS+=(--exclude="$line")
done < "$SCRIPT_DIR/.distignore"
fi
mkdir -p "$STAGE/$PLUGIN_SLUG"
rsync -a "${EXCLUDE_ARGS[@]}" "$SCRIPT_DIR/" "$STAGE/$PLUGIN_SLUG/"
mkdir -p "$OUT_DIR"
rm -f "$OUT_ZIP"
( cd "$STAGE" && zip -rq "$OUT_ZIP" "$PLUGIN_SLUG" )
SIZE=$(numfmt --to=iec --suffix=B "$(stat -c '%s' "$OUT_ZIP")")
COUNT=$(unzip -Z1 "$OUT_ZIP" | wc -l)
echo "✓ Built: $ZIP_NAME ($SIZE, $COUNT files)"