#!/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 )