1
1
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2
- # - validate Gradle Wrapper,
3
- # - run 'test' and 'verifyPlugin' tasks,
4
- # - run Qodana inspections,
5
- # - run 'buildPlugin' task and prepare artifact for the further tests,
6
- # - run 'runPluginVerifier' task,
7
- # - create a draft release.
2
+ # - Validate Gradle Wrapper.
3
+ # - Run 'test' and 'verifyPlugin' tasks.
4
+ # - Run Qodana inspections.
5
+ # - Run the 'buildPlugin' task and prepare artifact for further tests.
6
+ # - Run the 'runPluginVerifier' task.
7
+ # - Create a draft release.
8
8
#
9
- # Workflow is triggered on push and pull_request events.
9
+ # The workflow is triggered on push and pull_request events.
10
10
#
11
11
# GitHub Actions reference: https://help.github.com/en/actions
12
+ #
13
+ # # JBIJPPTPL
12
14
13
15
name : Build
14
16
on :
15
- # Trigger the workflow on pushes to only the 'master', 'support' and 'release' branches
17
+ # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
16
18
push :
17
19
branches :
18
20
- master
24
26
# Trigger the workflow on manual dispatch
25
27
workflow_dispatch :
26
28
29
+ concurrency :
30
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
31
+ cancel-in-progress : true
32
+
27
33
jobs :
34
+ guard :
35
+ name : Usage guard
36
+ runs-on : ubuntu-latest
37
+ steps :
38
+ # Uses the action-usage-guard action
39
+ - name : Run Action Usage Guard
40
+ uses : nekofar/action-usage-guard@develop
41
+ with :
42
+ # GitHub access token for authentication.
43
+ token : ${{ secrets.ACCESS_TOKEN }}
44
+ # Defines the threshold for the usage guard.
45
+ threshold : 70
28
46
29
47
# Prepare environment and build the plugin
30
48
build :
31
49
name : Build
32
50
runs-on : ubuntu-latest
51
+ needs : [ guard ]
33
52
outputs :
34
53
version : ${{ steps.properties.outputs.version }}
35
54
changelog : ${{ steps.changelog.outputs.changelog }}
36
55
pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
37
56
steps :
38
57
39
- # Free GitHub Actions Environment Disk Space
40
- - name : Maximize Build Space
41
- run : |
42
- sudo rm -rf /usr/share/dotnet
43
- sudo rm -rf /usr/local/lib/android
44
- sudo rm -rf /opt/ghc
45
-
46
- # Check out current repository
58
+ # Check out the current repository
47
59
- name : Fetch Sources
48
60
uses : actions/checkout@v4.2.0
49
61
50
62
# Validate wrapper
51
63
- name : Gradle Wrapper Validation
52
- uses : gradle/wrapper-validation-action@v3.4 .0
64
+ uses : gradle/actions/ wrapper-validation@v4.1 .0
53
65
54
- # Setup Java environment for the next steps
66
+ # Set up Java environment for the next steps
55
67
- name : Setup Java
56
68
uses : actions/setup-java@v4.4.0
57
69
with :
60
72
61
73
# Setup Gradle
62
74
- name : Setup Gradle
63
- uses : gradle/gradle-build-action@v3.5 .0
75
+ uses : gradle/actions/setup-gradle@v4.1 .0
64
76
65
77
# Set environment variables
66
78
- name : Export Properties
74
86
echo "version=$VERSION" >> $GITHUB_OUTPUT
75
87
echo "name=$NAME" >> $GITHUB_OUTPUT
76
88
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
77
-
78
- ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
79
89
80
90
# Extract changelog information
81
91
- name : Prepare Changelog
@@ -121,11 +131,11 @@ jobs:
121
131
runs-on : ubuntu-latest
122
132
steps :
123
133
124
- # Check out current repository
134
+ # Check out the current repository
125
135
- name : Fetch Sources
126
136
uses : actions/checkout@v4.2.0
127
137
128
- # Setup Java environment for the next steps
138
+ # Set up Java environment for the next steps
129
139
- name : Setup Java
130
140
uses : actions/setup-java@v4.4.0
131
141
with :
@@ -134,7 +144,7 @@ jobs:
134
144
135
145
# Setup Gradle
136
146
- name : Setup Gradle
137
- uses : gradle/gradle-build-action@v3.5 .0
147
+ uses : gradle/actions/setup-gradle@v4.1 .0
138
148
139
149
# Run tests
140
150
- name : Run Tests
@@ -148,11 +158,11 @@ jobs:
148
158
name : tests-result
149
159
path : ${{ github.workspace }}/build/reports/tests
150
160
151
- # Upload Kover report to CodeCov
161
+ # Upload the Kover report to CodeCov
152
162
- name : Upload Code Coverage Report
153
163
uses : codecov/codecov-action@v4.6.0
154
164
with :
155
- files : ${{ github.workspace }}/build/reports/kover/xml/ report.xml
165
+ files : ${{ github.workspace }}/build/reports/kover/report.xml
156
166
157
167
# Run Qodana inspections and provide report
158
168
inspectCode :
@@ -165,11 +175,21 @@ jobs:
165
175
pull-requests : write
166
176
steps :
167
177
168
- # Check out current repository
178
+ # Free GitHub Actions Environment Disk Space
179
+ - name : Maximize Build Space
180
+ uses : jlumbroso/free-disk-space@main
181
+ with :
182
+ tool-cache : false
183
+ large-packages : false
184
+
185
+ # Check out the current repository
169
186
- name : Fetch Sources
170
187
uses : actions/checkout@v4.2.0
188
+ with :
189
+ ref : ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
190
+ fetch-depth : 0 # a full history is required for pull request analysis
171
191
172
- # Setup Java environment for the next steps
192
+ # Set up Java environment for the next steps
173
193
- name : Setup Java
174
194
uses : actions/setup-java@v4.4.0
175
195
with :
@@ -185,20 +205,22 @@ jobs:
185
205
# Run plugin structure verification along with IntelliJ Plugin Verifier
186
206
verify :
187
207
name : Verify plugin
188
- needs : [ build, test, inspectCode ]
208
+ needs : [ build ]
189
209
runs-on : ubuntu-latest
190
210
steps :
191
- # Remove files to save space
192
- - name : Remove unnecessary files
193
- run : |
194
- sudo rm -rf /usr/share/dotnet
195
- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
196
211
197
- # Check out current repository
212
+ # Free GitHub Actions Environment Disk Space
213
+ - name : Maximize Build Space
214
+ uses : jlumbroso/free-disk-space@main
215
+ with :
216
+ tool-cache : false
217
+ large-packages : false
218
+
219
+ # Check out the current repository
198
220
- name : Fetch Sources
199
221
uses : actions/checkout@v4.2.0
200
222
201
- # Setup Java environment for the next steps
223
+ # Set up Java environment for the next steps
202
224
- name : Setup Java
203
225
uses : actions/setup-java@v4.4.0
204
226
with :
@@ -207,7 +229,7 @@ jobs:
207
229
208
230
# Setup Gradle
209
231
- name : Setup Gradle
210
- uses : gradle/gradle-build-action@v3.5 .0
232
+ uses : gradle/actions/setup-gradle@v4.1 .0
211
233
212
234
# Cache Plugin Verifier IDEs
213
235
- name : Setup Plugin Verifier IDEs Cache
@@ -218,7 +240,7 @@ jobs:
218
240
219
241
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
220
242
- name : Run Plugin Verification tasks
221
- run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
243
+ run : ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
222
244
223
245
# Collect Plugin Verifier Result
224
246
- name : Collect Plugin Verifier Result
@@ -233,23 +255,16 @@ jobs:
233
255
releaseDraft :
234
256
name : Release draft
235
257
if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/support/')
236
- needs : [ build, verify ]
258
+ needs : [ build, test, inspectCode, verify ]
237
259
runs-on : ubuntu-latest
238
260
permissions :
239
261
contents : write
240
262
steps :
241
263
242
- # Check out current repository
264
+ # Check out the current repository
243
265
- name : Fetch Sources
244
266
uses : actions/checkout@v4.2.0
245
267
246
- # Setup Java environment for the next steps
247
- - name : Setup Java
248
- uses : actions/setup-java@v4.4.0
249
- with :
250
- distribution : zulu
251
- java-version : 17
252
-
253
268
# Remove old release drafts by using the curl request for the available releases with a draft flag
254
269
- name : Remove Old Release Drafts
255
270
env :
@@ -261,17 +276,10 @@ jobs:
261
276
262
277
# Create a new release draft which is not publicly visible and requires manual acceptance
263
278
- name : Create Release Draft
264
- env :
265
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
266
- run : |
267
- gh release create v${{ needs.build.outputs.version }} \
268
- --draft \
269
- --title "v${{ needs.build.outputs.version }}" \
270
- --notes "$(cat << 'EOM'
271
- ${{ needs.build.outputs.changelog }}
272
- EOM
273
- )"
274
-
275
- concurrency :
276
- group : ${{ github.workflow }}-${{ github.ref }}
277
- cancel-in-progress : true
279
+ uses : nekofar/create-github-release@v1.0.14
280
+ with :
281
+ tag : v${{ needs.build.outputs.version }} # The name of the tag to be released
282
+ title : v${{ needs.build.outputs.version }} # The title for the release
283
+ notes : ${{ needs.build.outputs.changelog }} # The release notes generated in the previous step
284
+ draft : true # The release will be created as a draft
285
+ prerelease : ${{ contains(needs.build.outputs.version, '-rc') || contains(needs.build.outputs.version, '-beta') || contains(needs.build.outputs.version, '-alpha') }} # Conditions to mark the release as a pre-release
0 commit comments