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

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


The following commit(s) were added to refs/heads/main by this push:
     new e1dada9  ci(nightly): derive version from pluginVersion instead of 
tags (#75)
e1dada9 is described below

commit e1dada96f801c094469ae5ed99868fbc52781c41
Author: Lukasz Lenart <[email protected]>
AuthorDate: Thu Apr 9 06:57:59 2026 +0200

    ci(nightly): derive version from pluginVersion instead of tags (#75)
    
    Read the middle segment from pluginVersion in gradle.properties instead
    of computing it from the latest non-nightly git tag. Nightly counter
    increments within the same middle segment and resets automatically when
    pluginVersion is bumped for a new release.
    
    Made-with: Cursor
---
 .github/workflows/nightly.yml | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 2c85148..e03cbc0 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -96,28 +96,21 @@ jobs:
       - name: Generate Version
         id: version
         run: |
-          # 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 ' ')
+          PLUGIN_VERSION=$(grep "pluginVersion" gradle.properties | cut -d '=' 
-f2 | tr -d ' ')
+          BRANCH=$(echo "$PLUGIN_VERSION" | cut -d '.' -f1)
+          BUILD=$(echo "$PLUGIN_VERSION" | cut -d '.' -f2)
 
-          # Get the latest release tag to determine next build number
-          LATEST_RELEASE=$(git tag --list 'v*' --sort=-version:refname | grep 
-v 'nightly' | head -1)
-          LATEST_BUILD=$(echo "$LATEST_RELEASE" | sed 
's/v[0-9]*\.\([0-9]*\)\.[0-9]*/\1/')
+          # Check for existing nightly tags with the same middle segment
+          LATEST_NIGHTLY=$(git tag --list "v${BRANCH}.${BUILD}-nightly.*" 
--sort=-version:refname | head -1)
 
-          # Increment build number for nightly builds
-          BUILD=$((LATEST_BUILD + 1))
-
-          # Find latest nightly tag to avoid version collisions
-          LATEST_NIGHTLY=$(git tag --list 'v*-nightly.*' 
--sort=-version:refname | head -1)
-
-          if echo "$LATEST_NIGHTLY" | grep -q "nightly"; then
+          if [ -n "$LATEST_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.${NIGHTLY_NUM}/" gradle.properties
+          sed -i "s/pluginVersion = .*/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