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

lukaszlenart pushed a commit to branch ci/replace-nightly-prereleases-with-tags
in repository https://gitbox.apache.org/repos/asf/struts-intellij-plugin.git

commit 0d823445bfb399a1dc8d367e36623dbd27d4af3a
Author: Lukasz Lenart <[email protected]>
AuthorDate: Wed Feb 25 07:45:53 2026 +0100

    ci(nightly): replace GitHub pre-releases with lightweight git tags
    
    Switch nightly workflow from creating GitHub pre-releases to using
    lightweight git tags for change detection and version tracking.
    The plugin is already distributed via JetBrains Marketplace nightly
    channel and workflow artifacts, making pre-releases redundant.
    
    Changes:
    - Replace `gh release list` queries with `git tag` lookups
    - Remove `Delete Previous Pre-release` step
    - Replace `Create Pre-release` step with `Create Nightly Tag`
    - Add `fetch-depth: 0` to nightly-release checkout for tag access
    - Remove unnecessary GH_TOKEN env vars
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
---
 .github/workflows/nightly.yml | 85 +++++++++++--------------------------------
 1 file changed, 22 insertions(+), 63 deletions(-)

diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index ac56b68..7bc96ba 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -13,12 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Nightly workflow for building and publishing pre-release plugin versions.
+# Nightly workflow for building and publishing plugin versions to the nightly 
channel.
 #
 # Runs on a daily schedule (2:00 AM UTC) and checks if there are new commits
-# since the last pre-release. If changes are detected (or triggered manually),
-# it builds the plugin and publishes to the JetBrains Marketplace nightly 
channel
-# and creates a GitHub pre-release.
+# since the last nightly tag. If changes are detected (or triggered manually),
+# it builds the plugin and publishes to the JetBrains Marketplace nightly 
channel.
 
 name: Nightly
 on:
@@ -28,7 +27,7 @@ on:
 
 jobs:
 
-  # Check if there are new commits since the last pre-release
+  # Check if there are new commits since the last nightly tag
   check-changes:
     name: Check for changes
     runs-on: ubuntu-latest
@@ -45,19 +44,16 @@ jobs:
 
       - name: Check for new commits
         id: check
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
-          # Fetch the tag from the latest GitHub pre-release
-          LATEST_TAG=$(gh release list --limit 50 --json tagName,isPrerelease \
-            --jq '.[] | select(.isPrerelease == true) | .tagName | 
select(contains("nightly"))' | head -1)
+          # Find the latest nightly tag
+          LATEST_TAG=$(git tag --list 'v*-nightly.*' --sort=-version:refname | 
head -1)
 
           if [ -z "$LATEST_TAG" ]; then
-            # No previous pre-release exists — first run, always build
-            echo "No previous pre-release found, will build"
+            # No previous nightly tag exists — first run, always build
+            echo "No previous nightly tag found, will build"
             echo "has_changes=true" >> $GITHUB_OUTPUT
           else
-            # Count commits between last pre-release tag and HEAD
+            # Count commits between last nightly tag and HEAD
             COUNT=$(git rev-list "${LATEST_TAG}..HEAD" --count 2>/dev/null || 
echo "999")
             echo "Commits since ${LATEST_TAG}: ${COUNT}"
             if [ "$COUNT" -gt 0 ]; then
@@ -67,7 +63,7 @@ jobs:
             fi
           fi
 
-  # Build and publish nightly pre-release
+  # Build and publish nightly build
   nightly-release:
     name: Nightly release
     needs: [ check-changes ]
@@ -80,6 +76,8 @@ jobs:
       # Check out the current repository
       - name: Fetch Sources
         uses: actions/checkout@v6
+        with:
+          fetch-depth: 0
 
       # Set up Java environment
       - name: Setup Java
@@ -94,25 +92,22 @@ jobs:
         with:
           gradle-home-cache-cleanup: true
 
-      # Generate version for pre-release
+      # Generate version for nightly build
       - name: Generate Version
         id: version
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         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 ' ')
 
-          # Get the latest release version to determine next build number
-          LATEST_RELEASE=$(gh release list --limit 1 --exclude-pre-releases 
--json tagName --jq '.[0].tagName')
+          # 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/')
 
           # 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 | 
select(contains("nightly"))' | head -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
             NIGHTLY_NUM=$(echo "$LATEST_NIGHTLY" | sed 
's/.*-nightly\.\([0-9]*\)/\1/')
@@ -138,7 +133,7 @@ jobs:
       - name: Build Plugin
         run: ./gradlew buildPlugin --no-configuration-cache
 
-      # Publish pre-release to JetBrains Marketplace nightly channel
+      # Publish to JetBrains Marketplace nightly channel
       - name: Publish Plugin to Marketplace (Nightly)
         env:
           PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
@@ -166,44 +161,8 @@ jobs:
           name: ${{ steps.artifact.outputs.filename }}
           path: ./build/distributions/content/*/*
 
-      # Delete previous pre-release if it exists
-      - name: Delete Previous Pre-release
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        run: |
-          # Get the latest pre-release (excluding the current version we're 
about to create)
-          LATEST_PRERELEASE=$(gh release list --limit 50 --json 
tagName,isPrerelease --jq '.[] | select(.isPrerelease == true) | .tagName | 
select(contains("nightly"))' | head -1 2>/dev/null || echo "")
-
-          if [ -n "$LATEST_PRERELEASE" ] && [ "$LATEST_PRERELEASE" != "v${{ 
steps.version.outputs.version }}" ]; then
-            echo "Deleting previous pre-release: $LATEST_PRERELEASE"
-            gh release delete "$LATEST_PRERELEASE" --yes --cleanup-tag
-          else
-            echo "No previous pre-release found to delete"
-          fi
-
-      # Create a new pre-release
-      - name: Create Pre-release
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          CHANGELOG: ${{ steps.version.outputs.changelog }}
+      # Tag the nightly build for version tracking
+      - name: Create Nightly Tag
         run: |
-          # Find the plugin zip file
-          PLUGIN_ZIP=$(find ./build/distributions -name "*-signed.zip" -type f 
| head -1)
-          [ -z "$PLUGIN_ZIP" ] && PLUGIN_ZIP=$(find ./build/distributions 
-name "*.zip" -type f | head -1)
-
-          NOTES="🚀 **Nightly build v${{ steps.version.outputs.version }}**
-
-          This is an automated nightly build from the main branch.
-
-          ## Changes
-          ${CHANGELOG}
-
-          ## Installation
-          Download the plugin zip file and install it manually in IntelliJ 
IDEA via:
-          \`Settings → Plugins → ⚙️ → Install Plugin from Disk...\`"
-
-          gh release create "v${{ steps.version.outputs.version }}" \
-            --prerelease \
-            --title "v${{ steps.version.outputs.version }}" \
-            --notes "$NOTES" \
-            "$PLUGIN_ZIP"
+          git tag "v${{ steps.version.outputs.version }}"
+          git push origin "v${{ steps.version.outputs.version }}"

Reply via email to