#!/bin/bash # WordPress Plugin Build Script # Builds the plugin zip with the correct naming convention: cannaiq-menus-{version}.zip set -e # Get the version from the main plugin file VERSION=$(grep -oP "Version:\s*\K[0-9.]+" cannaiq-menus.php) if [ -z "$VERSION" ]; then echo "Error: Could not extract version from cannaiq-menus.php" exit 1 fi # Define paths PLUGIN_DIR="$(cd "$(dirname "$0")" && pwd)" OUTPUT_DIR="${PLUGIN_DIR}/../backend/public/downloads" OUTPUT_FILE="cannaiq-menus-${VERSION}.zip" echo "Building CannaIQ Menus 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}" # Exclude old/legacy files and build script zip -r "${OUTPUT_DIR}/${OUTPUT_FILE}" . \ -x "*.git*" \ -x "build-plugin.sh" \ -x "crawlsy-menus.php" \ -x "assets/css/crawlsy-menus.css" \ -x "assets/js/crawlsy-menus.js" echo "" echo "Build complete!" echo " File: ${OUTPUT_DIR}/${OUTPUT_FILE}" echo " Size: $(ls -lh "${OUTPUT_DIR}/${OUTPUT_FILE}" | awk '{print $5}')" echo "" echo "Download URL: https://cannaiq.co/downloads/cannaiq-menus-${VERSION}.zip"