You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2026/02/24 06:25:58 UTC

(struts-intellij-plugin) branch fix/nightly-version-collision created (now 7e9a6ca)

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch fix/nightly-version-collision
in repository https://gitbox.apache.org/repos/asf/struts-intellij-plugin.git


      at 7e9a6ca  ci(nightly): fix version collision in nightly workflow

This branch includes the following new commits:

     new 7e9a6ca  ci(nightly): fix version collision in nightly workflow

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(struts-intellij-plugin) 01/01: ci(nightly): fix version collision in nightly workflow

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch fix/nightly-version-collision
in repository https://gitbox.apache.org/repos/asf/struts-intellij-plugin.git

commit 7e9a6ca86cc7e624ba56d90a00567a57a56db0ce
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Tue Feb 24 07:25:44 2026 +0100

    ci(nightly): fix version collision in nightly workflow
    
    Two bugs caused nightly uploads to fail with duplicate version errors:
    
    1. Branch prefix was read from pluginSinceBuild (252) instead of
       pluginVersion (253), producing wrong version numbers.
    
    2. Nightly counter was hardcoded to .1, so re-triggers or retained
       Marketplace versions caused collisions. Now increments the counter
       from the latest pre-release tag.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <no...@anthropic.com>
---
 .github/workflows/nightly.yml | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 2f075fe..b8bb9ff 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -100,8 +100,8 @@ jobs:
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
-          # Get branch number from gradle.properties
-          BRANCH=$(grep "pluginSinceBuild" gradle.properties | cut -d '=' -f2 | tr -d ' ')
+          # Get branch number from pluginVersion prefix (e.g., "253" from "253.18970.1")
+          BRANCH=$(grep "pluginVersion" gradle.properties | cut -d '=' -f2 | cut -d '.' -f1 | tr -d ' ')
 
           # Get the latest release version to determine next build number
           LATEST_RELEASE=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // "v242.18969.1"' 2>/dev/null || echo "v242.18969.1")
@@ -110,8 +110,19 @@ jobs:
           # Increment build number for nightly builds
           BUILD=$((LATEST_BUILD + 1))
 
+          # Find latest pre-release nightly counter to avoid version collisions
+          LATEST_NIGHTLY=$(gh release list --limit 50 --json tagName,isPrerelease \
+            --jq '.[] | select(.isPrerelease == true) | .tagName' | head -1)
+
+          if echo "$LATEST_NIGHTLY" | grep -q "nightly"; then
+            NIGHTLY_NUM=$(echo "$LATEST_NIGHTLY" | sed 's/.*-nightly\.\([0-9]*\)/\1/')
+            NIGHTLY_NUM=$((NIGHTLY_NUM + 1))
+          else
+            NIGHTLY_NUM=1
+          fi
+
           # Update pluginVersion in gradle.properties
-          sed -i "s/pluginVersion = [0-9]*\.[0-9]*\.[0-9]*/pluginVersion = ${BRANCH}.${BUILD}-nightly.1/" gradle.properties
+          sed -i "s/pluginVersion = [0-9]*\.[0-9]*\.[0-9]*/pluginVersion = ${BRANCH}.${BUILD}-nightly.${NIGHTLY_NUM}/" gradle.properties
 
           # Get final version and changelog
           PROPERTIES="$(./gradlew properties --no-configuration-cache --console=plain -q)"