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 <[email protected]>
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 <[email protected]>
---
 .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)"

Reply via email to