diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index ca038807..9d51bf5b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -81,7 +81,7 @@ jobs: cache: "npm" - name: Install dependencies - run: npm ci + run: npm install - name: Setup PHP with Cached Composer uses: ./.github/actions/setup-php-composer diff --git a/plugins/hwp-previews/README.md b/plugins/hwp-previews/README.md index d2820c6e..4a4adcb3 100644 --- a/plugins/hwp-previews/README.md +++ b/plugins/hwp-previews/README.md @@ -8,7 +8,7 @@ ----- -[![Version](https://img.shields.io/badge/version-0.0.1-beta)]() +[![Version](https://img.shields.io/github/v/release/wpengine/hwptoolkit?include_prereleases&label=previews&filter=%40wpengine%2Fhwp-previews-wordpress-plugin-*)](https://github.com/wpengine/hwptoolkit/releases) [![License](https://img.shields.io/badge/license-GPLv2%2B-green)]() ![GitHub forks](https://img.shields.io/github/forks/wpengine/hwptoolkit?style=social) ![GitHub stars](https://img.shields.io/github/stars/wpengine/hwptoolkit?style=social) @@ -16,7 +16,6 @@ [![Code Coverage](https://img.shields.io/badge/coverage-%3E95%25-brightgreen?label=Code%20Coverage)](https://github.com/wpengine/hwptoolkit/actions) [![Code Quality](https://img.shields.io/github/check-runs/wpengine/hwptoolkit/main?checkName=hwp-previews%20php%20code%20quality%20checks&label=Code%20Quality%20Checks)](https://github.com/wpengine/hwptoolkit/actions) [![End-to-End Tests](https://img.shields.io/github/check-runs/wpengine/hwptoolkit/main?checkName=hwp-previews%20Playwright%20E2E%20Tests&label=End-to-End%20Tests)](https://github.com/wpengine/hwptoolkit/actions) - ----- diff --git a/plugins/hwp-previews/bin/sync-package-version.sh b/plugins/hwp-previews/bin/sync-package-version.sh new file mode 100755 index 00000000..22581777 --- /dev/null +++ b/plugins/hwp-previews/bin/sync-package-version.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Exit on any error +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Get the version from package.json +VERSION=$(node -p "require('./package.json').version") + +if [ -z "$VERSION" ]; then + echo -e "${RED}Error: Could not read version from package.json${NC}" + exit 1 +fi + +echo -e "${YELLOW}Syncing version ${VERSION} across all files...${NC}" + +# Update composer.json +if [ -f "composer.json" ]; then + echo "Updating composer.json..." + # Use sed to preserve original formatting (tabs/spaces) + sed -i.bak -E "s/(\"version\":[[:space:]]*\")[^\"]*(\",?)/\1$VERSION\2/" composer.json && rm composer.json.bak + echo -e "${GREEN}✓ Updated composer.json${NC}" +else + echo -e "${YELLOW}⚠ composer.json not found${NC}" +fi + +# Update readme.txt (WordPress style) +if [ -f "readme.txt" ]; then + echo "Updating readme.txt..." + sed -i.bak -E "s/(Stable tag:|Version:)[[:space:]]*[0-9]+\.[0-9]+\.[0-9]+/\1 $VERSION/g" readme.txt && rm readme.txt.bak + echo -e "${GREEN}✓ Updated readme.txt${NC}" +else + echo -e "${YELLOW}⚠ readme.txt not found${NC}" +fi + +# Update hwp-previews.php +PLUGIN_FILE="hwp-previews.php" + +if [ -f "$PLUGIN_FILE" ]; then + echo "Updating main plugin file: $PLUGIN_FILE..." + + # Update WordPress plugin header version (handles beta versions) + sed -i.bak -E "s/(\* Version:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?/\1$VERSION/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak" + + # Update HWP_PREVIEWS_VERSION define statement + sed -i.bak -E "s/(define\([[:space:]]*['\"]HWP_PREVIEWS_VERSION['\"][[:space:]]*,[[:space:]]*['\"])[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?(['\"][[:space:]]*\))/\1$VERSION\3/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak" + + echo -e "${GREEN}✓ Updated $PLUGIN_FILE${NC}" +else + echo -e "${YELLOW}⚠ $PLUGIN_FILE not found${NC}" +fi + +echo -e "${GREEN}✅ Version sync complete! All files updated to version ${VERSION}${NC}" +echo -e "${YELLOW}Files will be staged by the workflow's 'git add .' command${NC}"`` diff --git a/plugins/hwp-previews/composer.json b/plugins/hwp-previews/composer.json index fd79adbb..bbaa89fa 100644 --- a/plugins/hwp-previews/composer.json +++ b/plugins/hwp-previews/composer.json @@ -1,9 +1,9 @@ { - "name": "hwp/previews", + "name": "wpengine/previews", "type": "wordpress-plugin", "description": "A WordPress plugin for headless previews.", "license": "GPL-2.0", - "version": "0.0.1-beta", + "version": "0.0.4", "authors": [ { "name": "WP Engine Headless OSS Development Team", @@ -72,36 +72,35 @@ "archive": { "name": "hwp-previews", "exclude": [ - "/.*", - "bin", - "docker", - "docs", - "phpstan", - "phpcs", - "plugin-build", - "tests", - "!vendor", - "!vendor-prefixed", - "/docker-compose.yml", - "/phpstan.neon.dist", - "/psalm.xml", - "/phpcs.xml", + "/.DS_Store", + "/.docker/", + "/.env.dist", "/ACTIONS_AND_FILTERS.md", - "/phpcs-cache.json", + "/TESTING.md", "/Thumbs.db", + "/artifacts", "/auth.json", - "/.DS_Store", - ".docker/", - ".env.dist", - "c3.php", - "codeception.dist.yml", - "tests", - "artifacts", - "package.json", - "package-lock.json", - "node_modules/", - "/TESTING.md", - "/screenshots" + "/bin", + "/c3.php", + "/codeception.dist.yml", + "/docker", + "/docker-compose.yml", + "/docs", + "/examples", + "/node_modules", + "/package-lock.json", + "/package.json", + "/phpcs", + "/phpcs-cache.json", + "/phpcs.xml", + "/phpstan", + "/phpstan.neon.dist", + "/plugin-build", + "/psalm.xml", + "/screenshots", + "/tests", + "!vendor", + "!vendor-prefixed" ] }, "autoload": { diff --git a/plugins/hwp-previews/hwp-previews.php b/plugins/hwp-previews/hwp-previews.php index f9c6ba73..d1ad3e0f 100644 --- a/plugins/hwp-previews/hwp-previews.php +++ b/plugins/hwp-previews/hwp-previews.php @@ -7,7 +7,7 @@ * Author: WPEngine Headless OSS Team * Author URI: https://github.com/wpengine * Update URI: https://github.com/wpengine/hwptoolkit - * Version: 0.0.1-beta + * Version: 0.0.4 * Text Domain: hwp-previews * Domain Path: /languages * Requires at least: 6.0 @@ -67,7 +67,7 @@ function hwp_previews_init(): void { */ function hwp_previews_constants(): void { if ( ! defined( 'HWP_PREVIEWS_VERSION' ) ) { - define( 'HWP_PREVIEWS_VERSION', '0.0.1-beta' ); + define( 'HWP_PREVIEWS_VERSION', '0.0.4' ); } if ( ! defined( 'HWP_PREVIEWS_PLUGIN_DIR' ) ) { diff --git a/plugins/hwp-previews/package.json b/plugins/hwp-previews/package.json index e93642cf..f31db907 100644 --- a/plugins/hwp-previews/package.json +++ b/plugins/hwp-previews/package.json @@ -7,7 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js", "test:e2e:debug": "npm run test:e2e -- --debug", - "wp-env": "wp-env" + "wp-env": "wp-env", + "version": "./scripts/sync-versions.sh" }, "keywords": [], "author": "wpengine", diff --git a/plugins/hwp-previews/readme.txt b/plugins/hwp-previews/readme.txt index d5f5cd43..d6583eb0 100644 --- a/plugins/hwp-previews/readme.txt +++ b/plugins/hwp-previews/readme.txt @@ -4,7 +4,7 @@ Tags: GraphQL, Headless, Previews, WPGraphQL, React, Rest Requires at least: 6.0 Tested up to: 6.8.1 Requires PHP: 7.4 -Stable tag: 0.0.1-beta +Stable tag: 0.0.4 License: GPL-2.0 License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/plugins/wp-graphql-webhooks/bin/sync-package-version.sh b/plugins/wp-graphql-webhooks/bin/sync-package-version.sh new file mode 100755 index 00000000..910b03f7 --- /dev/null +++ b/plugins/wp-graphql-webhooks/bin/sync-package-version.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Exit on any error +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Get the version from package.json +VERSION=$(node -p "require('./package.json').version") + +if [ -z "$VERSION" ]; then + echo -e "${RED}Error: Could not read version from package.json${NC}" + exit 1 +fi + +echo -e "${YELLOW}Syncing version ${VERSION} across all files...${NC}" + +# Update composer.json +if [ -f "composer.json" ]; then + echo "Updating composer.json..." + # Use sed to preserve original formatting (tabs/spaces) + sed -i.bak -E "s/(\"version\":[[:space:]]*\")[^\"]*(\",?)/\1$VERSION\2/" composer.json && rm composer.json.bak + echo -e "${GREEN}✓ Updated composer.json${NC}" +else + echo -e "${YELLOW}⚠ composer.json not found${NC}" +fi + +# Update readme.txt (WordPress style) +if [ -f "readme.txt" ]; then + echo "Updating readme.txt..." + sed -i.bak -E "s/(Stable tag:|Version:)[[:space:]]*[0-9]+\.[0-9]+\.[0-9]+/\1 $VERSION/g" readme.txt && rm readme.txt.bak + echo -e "${GREEN}✓ Updated readme.txt${NC}" +else + echo -e "${YELLOW}⚠ readme.txt not found${NC}" +fi + +# Update wp-graphql-webhooks.php +PLUGIN_FILE="wp-graphql-webhooks.php" + +if [ -f "$PLUGIN_FILE" ]; then + echo "Updating main plugin file: $PLUGIN_FILE..." + + # Update WordPress plugin header version (handles beta versions) + sed -i.bak -E "s/(\* Version:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?/\1$VERSION/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak" + + # Update WPGRAPHQL_WEBHOOKS_VERSION define statement + sed -i.bak -E "s/(define\([[:space:]]*['\"]WPGRAPHQL_WEBHOOKS_VERSION['\"][[:space:]]*,[[:space:]]*['\"])[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?(['\"][[:space:]]*\))/\1$VERSION\3/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak" + + echo -e "${GREEN}✓ Updated $PLUGIN_FILE${NC}" +else + echo -e "${YELLOW}⚠ $PLUGIN_FILE not found${NC}" +fi + +echo -e "${GREEN}✅ Version sync complete! All files updated to version ${VERSION}${NC}" +echo -e "${YELLOW}Files will be staged by the workflow's 'git add .' command${NC}"`` diff --git a/plugins/wp-graphql-webhooks/composer.json b/plugins/wp-graphql-webhooks/composer.json index ab9b7a14..eed72e74 100644 --- a/plugins/wp-graphql-webhooks/composer.json +++ b/plugins/wp-graphql-webhooks/composer.json @@ -2,7 +2,8 @@ "name": "wpengine/wp-graphql-webhooks", "description": "Headless webhooks for WPGraphQL", "type": "library", - "license": "GPL-3.0-or-later", + "license": "GPL-2.0", + "version": "0.0.2", "authors": [ { "name": "WP Engine Headless OSS Development Team", @@ -101,6 +102,7 @@ "/bin", "/wp-graphql-webhooks", "/composer.lock", + "/examples", "/phpstan.neon.dist", "/README.md" ] diff --git a/plugins/wp-graphql-webhooks/package.json b/plugins/wp-graphql-webhooks/package.json index 6e4b1468..dd9a9972 100644 --- a/plugins/wp-graphql-webhooks/package.json +++ b/plugins/wp-graphql-webhooks/package.json @@ -4,7 +4,8 @@ "private": true, "description": "Webhooks solution for WordPress", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "version": "./scripts/sync-versions.sh" }, "keywords": [], "author": "wpengine", @@ -16,4 +17,4 @@ "@wordpress/jest-console": "^8.26.0", "@wordpress/scripts": "^30.19.0" } -} \ No newline at end of file +} diff --git a/plugins/wp-graphql-webhooks/readme.txt b/plugins/wp-graphql-webhooks/readme.txt index dcfc9e7b..b5e95f70 100644 --- a/plugins/wp-graphql-webhooks/readme.txt +++ b/plugins/wp-graphql-webhooks/readme.txt @@ -5,7 +5,7 @@ Requires at least: 6.0 Tested up to: 6.8.1 Requires PHP: 7.4 Requires WPGraphQL: 1.8.0 -Stable tag: 0.0.1 +Stable tag: 0.0.2 License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/plugins/wp-graphql-webhooks/wp-graphql-webhooks.php b/plugins/wp-graphql-webhooks/wp-graphql-webhooks.php index c721b6b4..8344d730 100644 --- a/plugins/wp-graphql-webhooks/wp-graphql-webhooks.php +++ b/plugins/wp-graphql-webhooks/wp-graphql-webhooks.php @@ -7,7 +7,7 @@ * Author: WPEngine OSS Team * Author URI: https://github.com/wpengine * Update URI: https://github.com/wpengine/hwptoolkit - * Version: 0.0.1 + * Version: 0.0.2 * Text Domain: wp-graphql-webhooks * Domain Path: /languages * Requires at least: 6.0 @@ -60,7 +60,7 @@ function graphql_webhooks_constants(): void { // Plugin version. if ( ! defined( 'WPGRAPHQL_WEBHOOKS_VERSION' ) ) { - define( 'WPGRAPHQL_WEBHOOKS_VERSION', '0.0.1' ); + define( 'WPGRAPHQL_WEBHOOKS_VERSION', '0.0.2' ); } // Plugin Folder Path.