#!/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. 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" # rsync honours .distignore-style excludes. rsync -a --delete \ --exclude-from="$ROOT/.distignore" \ --exclude 'build' \ "$ROOT/" "$STAGE/" ( cd "$BUILD" rm -f "$SLUG.zip" zip -rq "$SLUG.zip" "$SLUG" ) echo "Created $BUILD/$SLUG.zip" unzip -l "$BUILD/$SLUG.zip" | tail -n +4 | head -n -2 | awk '{print $4}'