rsync is not available everywhere; tar honours the same .distignore patterns and ships with every CI runner. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJxAHYdMfKPoN4koRc4Ci2
25 lines
678 B
Bash
Executable file
25 lines
678 B
Bash
Executable file
#!/usr/bin/env bash
|
||
# Builds build/m365-login.zip – the folder inside the archive is named after the
|
||
# WordPress.org slug (m365-login), regardless of the repository name.
|
||
# Only needs bash, tar and zip.
|
||
set -euo pipefail
|
||
|
||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
SLUG="m365-login"
|
||
BUILD="$ROOT/build"
|
||
STAGE="$BUILD/$SLUG"
|
||
|
||
rm -rf "$BUILD"
|
||
mkdir -p "$STAGE"
|
||
|
||
# Copy everything except the patterns listed in .distignore.
|
||
tar -C "$ROOT" --exclude-from="$ROOT/.distignore" --exclude='./build' -cf - . | tar -C "$STAGE" -xf -
|
||
|
||
(
|
||
cd "$BUILD"
|
||
rm -f "$SLUG.zip"
|
||
zip -rq "$SLUG.zip" "$SLUG"
|
||
)
|
||
|
||
echo "Created $BUILD/$SLUG.zip"
|
||
( cd "$STAGE" && find . -type f | sort )
|