Skip to content

Commit 71127d9

Browse files
committed
Update template, fix verification and actions
1 parent ad143ee commit 71127d9

File tree

8 files changed

+128
-147
lines changed

8 files changed

+128
-147
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -23,56 +23,39 @@ on:
2323
- "gradle.properties"
2424
- "README.md"
2525

26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
28+
cancel-in-progress: true
29+
2630
jobs:
2731

28-
# Prepare environment and build the plugin
32+
# Prepare the environment and build the plugin
2933
build:
3034
name: Build
3135
runs-on: ubuntu-latest
32-
outputs:
33-
version: ${{ steps.properties.outputs.version }}
34-
changelog: ${{ steps.properties.outputs.changelog }}
35-
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3636
steps:
3737

38-
# Check out current repository
38+
# Free GitHub Actions Environment Disk Space
39+
- name: Maximize Build Space
40+
uses: jlumbroso/[email protected]
41+
with:
42+
tool-cache: false
43+
large-packages: false
44+
45+
# Check out the current repository
3946
- name: Fetch Sources
4047
uses: actions/checkout@v4
4148

42-
# Validate wrapper
43-
- name: Gradle Wrapper Validation
44-
uses: gradle/[email protected]
45-
46-
# Set up Java environment for the next steps
49+
# Set up the Java environment for the next steps
4750
- name: Setup Java
4851
uses: actions/setup-java@v4
4952
with:
5053
distribution: zulu
51-
java-version: 17
54+
java-version: 21
5255

5356
# Setup Gradle
5457
- name: Setup Gradle
55-
uses: gradle/gradle-build-action@v2
56-
with:
57-
gradle-home-cache-cleanup: true
58-
59-
# Set environment variables
60-
- name: Export Properties
61-
id: properties
62-
shell: bash
63-
run: |
64-
PROPERTIES="$(./gradlew properties --console=plain -q)"
65-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
66-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
67-
68-
echo "version=$VERSION" >> $GITHUB_OUTPUT
69-
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
70-
71-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
72-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
73-
echo "EOF" >> $GITHUB_OUTPUT
74-
75-
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
58+
uses: gradle/actions/setup-gradle@v4
7659

7760
# Build plugin
7861
- name: Build plugin
@@ -89,9 +72,9 @@ jobs:
8972
9073
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
9174
92-
# Store already-built plugin as an artifact for downloading
75+
# Store an already-built plugin as an artifact for downloading
9376
- name: Upload artifact
94-
uses: actions/upload-artifact@v3
77+
uses: actions/upload-artifact@v4
9578
with:
9679
name: ${{ steps.artifact.outputs.filename }}
9780
path: ./build/distributions/content/*/*
@@ -103,22 +86,29 @@ jobs:
10386
runs-on: ubuntu-latest
10487
steps:
10588

106-
# Check out current repository
89+
# Free GitHub Actions Environment Disk Space
90+
- name: Maximize Build Space
91+
uses: jlumbroso/[email protected]
92+
with:
93+
tool-cache: false
94+
large-packages: false
95+
96+
# Check out the current repository
10797
- name: Fetch Sources
10898
uses: actions/checkout@v4
10999

110-
# Set up Java environment for the next steps
100+
# Set up the Java environment for the next steps
111101
- name: Setup Java
112102
uses: actions/setup-java@v4
113103
with:
114104
distribution: zulu
115-
java-version: 17
105+
java-version: 21
116106

117107
# Setup Gradle
118108
- name: Setup Gradle
119-
uses: gradle/gradle-build-action@v2
109+
uses: gradle/actions/setup-gradle@v4
120110
with:
121-
gradle-home-cache-cleanup: true
111+
cache-read-only: true
122112

123113
# Run tests
124114
- name: Run Tests
@@ -127,7 +117,7 @@ jobs:
127117
# Collect Tests Result of failed tests
128118
- name: Collect Tests Result
129119
if: ${{ failure() }}
130-
uses: actions/upload-artifact@v3
120+
uses: actions/upload-artifact@v4
131121
with:
132122
name: tests-result
133123
path: ${{ github.workspace }}/build/reports/tests
@@ -141,69 +131,55 @@ jobs:
141131

142132
# Free GitHub Actions Environment Disk Space
143133
- name: Maximize Build Space
144-
uses: jlumbroso/free-disk-space@main
134+
uses: jlumbroso/free-disk-space@v1.3.1
145135
with:
146136
tool-cache: false
147137
large-packages: false
148138

149-
# Check out current repository
139+
# Check out the current repository
150140
- name: Fetch Sources
151141
uses: actions/checkout@v4
152142

153-
# Set up Java environment for the next steps
143+
# Set up the Java environment for the next steps
154144
- name: Setup Java
155145
uses: actions/setup-java@v4
156146
with:
157147
distribution: zulu
158-
java-version: 17
148+
java-version: 21
159149

160150
# Setup Gradle
161151
- name: Setup Gradle
162-
uses: gradle/gradle-build-action@v2
163-
with:
164-
gradle-home-cache-cleanup: true
165-
166-
# Cache Plugin Verifier IDEs
167-
- name: Setup Plugin Verifier IDEs Cache
168-
uses: actions/cache@v3
152+
uses: gradle/actions/setup-gradle@v4
169153
with:
170-
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
171-
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
154+
cache-read-only: true
172155

173156
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
174157
- name: Run Plugin Verification tasks
175-
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
158+
run: ./gradlew verifyPlugin
176159

177160
# Collect Plugin Verifier Result
178161
- name: Collect Plugin Verifier Result
179162
if: ${{ always() }}
180-
uses: actions/upload-artifact@v3
163+
uses: actions/upload-artifact@v4
181164
with:
182165
name: pluginVerifier-result
183166
path: ${{ github.workspace }}/build/reports/pluginVerifier
184167

185168
# Prepare a draft release for GitHub Releases page for the manual verification
186-
# If accepted and published, release workflow would be triggered
169+
# If accepted and published, the release workflow would be triggered
187170
releaseDraft:
188171
name: Release draft
189172
if: github.event_name != 'pull_request'
190-
needs: [ build, test, verify ]
173+
needs: [ build, test, inspectCode, verify ]
191174
runs-on: ubuntu-latest
192175
permissions:
193176
contents: write
194177
steps:
195178

196-
# Check out current repository
179+
# Check out the current repository
197180
- name: Fetch Sources
198181
uses: actions/checkout@v4
199182

200-
# Set up Java environment for the next steps
201-
- name: Setup Java
202-
uses: actions/setup-java@v4
203-
with:
204-
distribution: zulu
205-
java-version: 17
206-
207183
# Remove old release drafts by using the curl request for the available releases with a draft flag
208184
- name: Remove Old Release Drafts
209185
env:
@@ -218,10 +194,11 @@ jobs:
218194
env:
219195
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220196
run: |
221-
gh release create v${{ needs.build.outputs.version }} \
197+
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
198+
RELEASE_NOTE="./build/tmp/release_note.txt"
199+
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
200+
201+
gh release create $VERSION \
222202
--draft \
223-
--title "v${{ needs.build.outputs.version }}" \
224-
--notes "$(cat << 'EOM'
225-
${{ needs.build.outputs.changelog }}
226-
EOM
227-
)"
203+
--title $VERSION \
204+
--notes-file $RELEASE_NOTE

.github/workflows/release.yml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Release
22
on:
33
release:
4-
types: [ prereleased, released ]
4+
types: [prereleased, released]
55

66
jobs:
77

@@ -14,46 +14,43 @@ jobs:
1414
pull-requests: write
1515
steps:
1616

17-
# Check out current repository
17+
# Free GitHub Actions Environment Disk Space
18+
- name: Maximize Build Space
19+
uses: jlumbroso/[email protected]
20+
with:
21+
tool-cache: false
22+
large-packages: false
23+
24+
# Check out the current repository
1825
- name: Fetch Sources
1926
uses: actions/checkout@v4
2027
with:
2128
ref: ${{ github.event.release.tag_name }}
2229

23-
# Set up Java environment for the next steps
30+
# Set up the Java environment for the next steps
2431
- name: Setup Java
2532
uses: actions/setup-java@v4
2633
with:
2734
distribution: zulu
28-
java-version: 17
35+
java-version: 21
2936

3037
# Setup Gradle
3138
- name: Setup Gradle
32-
uses: gradle/gradle-build-action@v2
39+
uses: gradle/actions/setup-gradle@v4
3340
with:
34-
gradle-home-cache-cleanup: true
41+
cache-read-only: true
3542

36-
# Set environment variables
37-
- name: Export Properties
38-
id: properties
39-
shell: bash
40-
run: |
41-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
42-
${{ github.event.release.body }}
43-
EOM
44-
)"
45-
46-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
47-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
48-
echo "EOF" >> $GITHUB_OUTPUT
49-
50-
# Update Unreleased section with the current release note
43+
# Update the Unreleased section with the current release note
5144
- name: Patch Changelog
52-
if: ${{ steps.properties.outputs.changelog != '' }}
45+
if: ${{ github.event.release.body != '' }}
5346
env:
54-
CHANGELOG: ${{ steps.properties.outputs.changelog }}
47+
CHANGELOG: ${{ github.event.release.body }}
5548
run: |
56-
./gradlew patchChangelog --release-note="$CHANGELOG"
49+
RELEASE_NOTE="./build/tmp/release_note.txt"
50+
mkdir -p "$(dirname "$RELEASE_NOTE")"
51+
echo "$CHANGELOG" > $RELEASE_NOTE
52+
53+
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
5754
5855
# Publish the plugin to JetBrains Marketplace
5956
- name: Publish Plugin
@@ -64,7 +61,7 @@ jobs:
6461
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
6562
run: ./gradlew publishPlugin
6663

67-
# Upload artifact as a release asset
64+
# Upload an artifact as a release asset
6865
- name: Upload Release Asset
6966
env:
7067
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.gradle
22
.idea
3+
.intellijPlatform
4+
.kotlin
35
build/
46
!gradle/wrapper/gradle-wrapper.jar
57
!**/src/main/**/build/
@@ -38,6 +40,7 @@ bin/
3840

3941
### VS Code ###
4042
.vscode/
43+
.cursor/
4144

4245
### Mac OS ###
4346
.DS_Store

0 commit comments

Comments
 (0)