Commit 391b6d4dc9 for woocommerce

commit 391b6d4dc900af8d77f272041eddceca9f33b0a0
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date:   Wed Jan 14 14:14:45 2026 +0000

    Allow releases in prior release branches to bypass stable tag checks (#62759)

diff --git a/.github/workflows/release-build-zip-file.yml b/.github/workflows/release-build-zip-file.yml
index 2d78059466..aa9babe8f1 100644
--- a/.github/workflows/release-build-zip-file.yml
+++ b/.github/workflows/release-build-zip-file.yml
@@ -121,11 +121,21 @@ jobs:
             fi

             # Stable version in release branch should match wporg.
+            svn_trunk_version=$( wget --quiet https://plugins.svn.wordpress.org/woocommerce/trunk/woocommerce.php -O /dev/stdout |  grep -oP '(?<=Version: )(.+)' | head -n1 )
             svn_stable_version=$( wget --quiet https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt -O /dev/stdout |  grep -oP '(?<=Stable tag: )(.+)' | head -n1 )
-            branch_stable_version=$( cat checkout-branch/plugins/woocommerce/readme.txt | grep -oP '(?<=Stable tag: )(.+)' | head -n1 )
-            if [[ $branch_stable_version != $svn_stable_version ]] ; then
+
+            if [[ -z "$svn_trunk_version" || -z "$svn_stable_version" ]]; then
+                echo "::error::Pre-build verification: could not determine current version number or stable tag from SVN."
+                exit 1
+            fi
+
+            if php -r "exit( version_compare('$branch_plugin_version', '$svn_trunk_version', '>') ? 0 : 1 );"; then
+              branch_stable_version=$( cat checkout-branch/plugins/woocommerce/readme.txt | grep -oP '(?<=Stable tag: )(.+)' | head -n1 )
+
+              if [[ $branch_stable_version != $svn_stable_version ]] ; then
                 echo "::error::Pre-build verification: stable version in release branch ($branch_stable_version) is not matching the one in SVN trunk ($svn_stable_version)."
                 exit 1
+              fi
             fi

             # No PRs against release branch should remain open.
diff --git a/.github/workflows/release-upload-to-wporg.yml b/.github/workflows/release-upload-to-wporg.yml
index 06b862c2a2..72eef1679b 100644
--- a/.github/workflows/release-upload-to-wporg.yml
+++ b/.github/workflows/release-upload-to-wporg.yml
@@ -132,15 +132,29 @@ jobs:
           fi

           if php -r "die( version_compare( '$RELEASE_TAG', '$svn_plugin_version', '>' ) ? 0 : 1 );"; then
+            # Check that the stable tag in the release matches the stable tag in SVN.
+            svn_stable_version=$( svn cat "$SVN_URL/trunk/readme.txt" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" |  grep -oP '(?<=Stable tag: )(.+)' | head -n1 )
+            stable_tag_in_release=$(cat woocommerce/readme.txt | grep -oP '(?<=Stable tag: )(.+)' | head -n1)
+
+            if [[ -z "$svn_stable_version" || $svn_stable_version != $stable_tag_in_release ]]; then
+              echo "::error::Stable tag in SVN ($svn_stable_version) does not match release stable tag ($stable_tag_in_release)."
+              exit 1
+            fi
+
             echo "overwrite_trunk=1" >> "$GITHUB_OUTPUT"
           else
             echo "overwrite_trunk=0" >> "$GITHUB_OUTPUT"
           fi

+      - if: ${{ github.repository != 'woocommerce/woocommerce' }}
+        run: |
+          echo "::notice::This is not the 'woocommerce/woocommerce' repository. Commit to WordPress.org SVN will be skipped."
+
   commit:
     name: Commit release to WordPress.org
-    runs-on: ${{ ( github.repository == 'woocommerce/woocommerce' && 'blacksmith-2vcpu-ubuntu-2404' ) || 'ubuntu-latest' }}
+    runs-on: blacksmith-2vcpu-ubuntu-2404
     needs: [get-and-validate-release-asset]
+    if: ${{ github.repository == 'woocommerce/woocommerce' }}
     permissions:
       contents: write # Required to fetch draft releases for some reason. See https://github.com/cli/cli/issues/9076#issuecomment-2146148572.
     env: