Skip to content

Commit 3d05a72

Browse files
committed
Improve release workflow with modern practices
- Remove deprecated actions/create-release@v1 action - Use only softprops/action-gh-release@v1 for GitHub releases - Add Gradle setup using gradle-build-action for consistency - Add Gradle dependency caching for faster builds - Add plugin validation step before publishing - Switch from ./gradlew to gradle command (consistent with CI) - Add --no-daemon flag to all Gradle commands - Remove unnecessary chmod +x gradlew step - Align release workflow with CI workflow patterns
1 parent c5dcb8a commit 3d05a72

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ jobs:
2323
java-version: '17'
2424
distribution: 'temurin'
2525

26+
- name: Setup Gradle
27+
uses: gradle/gradle-build-action@v2
28+
with:
29+
gradle-version: wrapper # Use wrapper version
30+
31+
- name: Cache Gradle dependencies
32+
uses: actions/cache@v3
33+
with:
34+
path: |
35+
~/.gradle/caches
36+
~/.gradle/wrapper
37+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}
38+
restore-keys: |
39+
${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
40+
${{ runner.os }}-gradle-
41+
2642
- name: Extract version from tag
2743
id: version
2844
run: |
@@ -94,11 +110,11 @@ jobs:
94110
echo "$CHANGELOG" | head -c 200
95111
echo ""
96112
97-
- name: Grant execute permission for gradlew
98-
run: chmod +x gradlew
99-
100113
- name: Build plugin
101-
run: ./gradlew clean build -x test
114+
run: gradle clean build -x test --no-daemon
115+
116+
- name: Validate plugin
117+
run: gradle validatePlugins --no-daemon
102118

103119
- name: Publish to Maven Central (Sonatype)
104120
env:
@@ -107,36 +123,16 @@ jobs:
107123
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
108124
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
109125
run: |
110-
./gradlew publishToSonatype closeStagingRepositories
126+
gradle publishToSonatype closeStagingRepositories --no-daemon
111127
112128
- name: Publish to Gradle Plugin Portal
113129
env:
114130
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
115131
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
116132
run: |
117-
./gradlew publishPlugins
133+
gradle publishPlugins --no-daemon
118134
119135
- name: Create GitHub Release
120-
uses: actions/create-release@v1
121-
env:
122-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123-
with:
124-
tag_name: ${{ github.ref }}
125-
release_name: Release ${{ steps.version.outputs.version }}
126-
body: |
127-
## Version ${{ steps.version.outputs.version }}
128-
129-
${{ steps.changelog.outputs.changelog }}
130-
131-
---
132-
133-
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.ref }}
134-
draft: false
135-
prerelease: false
136-
continue-on-error: true # Continue even if release creation fails (might already exist)
137-
138-
- name: Create GitHub Release (alternative method)
139-
if: failure() # Only if previous step failed
140136
uses: softprops/action-gh-release@v1
141137
with:
142138
tag_name: ${{ github.ref }}

0 commit comments

Comments
 (0)