#!/bin/bash # WordPress Plugin Build Script # Builds the plugin zip with the correct naming convention: cb-wpmenu-{version}.zip set -e # Get the version from the main plugin file VERSION=$(grep -oP "Version:\s*\K[0-9.]+" crawlsy-menus.php) if [ -z "$VERSION" ]; then echo "Error: Could not extract version from crawlsy-menus.php" exit 1 fi # Define paths PLUGIN_DIR="$(cd "$(dirname "$0")" && pwd)" OUTPUT_DIR="${PLUGIN_DIR}/../backend/public/downloads" OUTPUT_FILE="cb-wpmenu-${VERSION}.zip" echo "Building WordPress plugin..." echo " Version: ${VERSION}" echo " Output: ${OUTPUT_DIR}/${OUTPUT_FILE}" # Ensure output directory exists mkdir -p "${OUTPUT_DIR}" # Create the zip file (from the plugin directory) cd "${PLUGIN_DIR}" rm -f "${OUTPUT_DIR}/${OUTPUT_FILE}" zip -r "${OUTPUT_DIR}/${OUTPUT_FILE}" . -x "*.git*" -x "build-plugin.sh" echo "" echo "Build complete!" echo " File: ${OUTPUT_DIR}/${OUTPUT_FILE}" echo " Size: $(ls -lh "${OUTPUT_DIR}/${OUTPUT_FILE}" | awk '{print $5}')" echo "" echo "IMPORTANT: Update frontend/src/pages/LandingPage.tsx with the new version:" echo " href=\"/downloads/cb-wpmenu-${VERSION}.zip\"" echo " Download Plugin v${VERSION}"