From d3a4878170bc02a7196de53cc608a9fe9260d006 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 20 Oct 2023 13:22:13 -0400 Subject: [PATCH 1/2] validate that tested version matches the wp-env version --- .github/workflows/upload-asset-on-release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/upload-asset-on-release.yml b/.github/workflows/upload-asset-on-release.yml index 64eab2231..6988cdbfd 100644 --- a/.github/workflows/upload-asset-on-release.yml +++ b/.github/workflows/upload-asset-on-release.yml @@ -36,6 +36,15 @@ jobs: [[ "$taggedVersion" == "$pluginConstantVersion" ]] || exit 1 [[ "$taggedVersion" == "$pluginPackageVersion" ]] || exit 1 + - name: Validate WP Versions + if: ${{ (github.repository == 'bluehost/bluehost-wordpress-plugin') && (github.event.release.prerelease == false) }} + run: | + pluginHeaderTestedVersion=`grep "Tested up to:" bluehost-wordpress-plugin.php | grep -Eo "[0-9\.]*"` + wpEnvVersion=`grep "WordPress/WordPress#tags/" .wp-env.json | grep -Eo "[0-9\.]*"` + echo "Plugin header tested version: $pluginHeaderTestedVersion" + echo "wp-env version: $wpEnvVersion" + [[ "$wpEnvVersion" == "$pluginHeaderTestedVersion" ]] || exit 1 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: From ae347d7a75bfd4000790609b67f1bf0b4a825be0 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 23 Oct 2023 18:04:11 -0400 Subject: [PATCH 2/2] move wp version check to after npm setup steps so we know its also the latest wp --- .github/workflows/upload-asset-on-release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/upload-asset-on-release.yml b/.github/workflows/upload-asset-on-release.yml index 6988cdbfd..cce4b2c34 100644 --- a/.github/workflows/upload-asset-on-release.yml +++ b/.github/workflows/upload-asset-on-release.yml @@ -36,15 +36,6 @@ jobs: [[ "$taggedVersion" == "$pluginConstantVersion" ]] || exit 1 [[ "$taggedVersion" == "$pluginPackageVersion" ]] || exit 1 - - name: Validate WP Versions - if: ${{ (github.repository == 'bluehost/bluehost-wordpress-plugin') && (github.event.release.prerelease == false) }} - run: | - pluginHeaderTestedVersion=`grep "Tested up to:" bluehost-wordpress-plugin.php | grep -Eo "[0-9\.]*"` - wpEnvVersion=`grep "WordPress/WordPress#tags/" .wp-env.json | grep -Eo "[0-9\.]*"` - echo "Plugin header tested version: $pluginHeaderTestedVersion" - echo "wp-env version: $wpEnvVersion" - [[ "$wpEnvVersion" == "$pluginHeaderTestedVersion" ]] || exit 1 - - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -99,6 +90,15 @@ jobs: - name: NPM Install run: npm install --legacy-peer-deps + - name: Validate WP Versions + if: ${{ (github.repository == 'bluehost/bluehost-wordpress-plugin') && (github.event.release.prerelease == false) }} + run: | + pluginHeaderTestedVersion=`grep "Tested up to:" bluehost-wordpress-plugin.php | grep -Eo "[0-9\.]*"` + wpEnvVersion=`grep "WordPress/WordPress#tags/" .wp-env.json | grep -Eo "[0-9\.]*"` + echo "Plugin header tested version: $pluginHeaderTestedVersion" + echo "wp-env version: $wpEnvVersion" + [[ "$wpEnvVersion" == "$pluginHeaderTestedVersion" ]] || exit 1 + - name: Build JavaScript run: npm run build