Skip to content

Commit 41367e5

Browse files
committed
chore: update GitHub Actions workflows to use latest action versions and improve build space management
1 parent 68b40aa commit 41367e5

3 files changed

Lines changed: 111 additions & 82 deletions

File tree

.github/workflows/build.yml

Lines changed: 85 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,33 @@ concurrency:
2626

2727
jobs:
2828

29-
# Prepare environment and build the plugin
29+
# Prepare the environment and build the plugin
3030
build:
3131
name: Build
3232
runs-on: ubuntu-latest
33-
outputs:
34-
version: ${{ steps.properties.outputs.version }}
35-
changelog: ${{ steps.properties.outputs.changelog }}
36-
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3733
steps:
3834

35+
# Free GitHub Actions Environment Disk Space
36+
- name: Maximize Build Space
37+
uses: jlumbroso/free-disk-space@v1.3.1
38+
with:
39+
tool-cache: false
40+
large-packages: false
41+
3942
# Check out the current repository
4043
- name: Fetch Sources
41-
uses: actions/checkout@v4
44+
uses: actions/checkout@v5
4245

43-
# Set up Java environment for the next steps
46+
# Set up the Java environment for the next steps
4447
- name: Setup Java
45-
uses: actions/setup-java@v4
48+
uses: actions/setup-java@v5
4649
with:
4750
distribution: zulu
4851
java-version: 21
4952

5053
# Setup Gradle
5154
- name: Setup Gradle
52-
uses: gradle/actions/setup-gradle@v4
53-
54-
# Set environment variables
55-
- name: Export Properties
56-
id: properties
57-
shell: bash
58-
run: |
59-
PROPERTIES="$(./gradlew properties --console=plain -q)"
60-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
61-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
62-
63-
echo "version=$VERSION" >> $GITHUB_OUTPUT
64-
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
65-
66-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
67-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
68-
echo "EOF" >> $GITHUB_OUTPUT
55+
uses: gradle/actions/setup-gradle@v5
6956

7057
# Build plugin
7158
- name: Build plugin
@@ -82,9 +69,9 @@ jobs:
8269
8370
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
8471
85-
# Store already-built plugin as an artifact for downloading
72+
# Store an already-built plugin as an artifact for downloading
8673
- name: Upload artifact
87-
uses: actions/upload-artifact@v4
74+
uses: actions/upload-artifact@v5
8875
with:
8976
name: ${{ steps.artifact.outputs.filename }}
9077
path: ./build/distributions/content/*/*
@@ -96,20 +83,29 @@ jobs:
9683
runs-on: ubuntu-latest
9784
steps:
9885

86+
# Free GitHub Actions Environment Disk Space
87+
- name: Maximize Build Space
88+
uses: jlumbroso/free-disk-space@v1.3.1
89+
with:
90+
tool-cache: false
91+
large-packages: false
92+
9993
# Check out the current repository
10094
- name: Fetch Sources
101-
uses: actions/checkout@v4
95+
uses: actions/checkout@v5
10296

103-
# Set up Java environment for the next steps
97+
# Set up the Java environment for the next steps
10498
- name: Setup Java
105-
uses: actions/setup-java@v4
99+
uses: actions/setup-java@v5
106100
with:
107101
distribution: zulu
108102
java-version: 21
109103

110104
# Setup Gradle
111105
- name: Setup Gradle
112-
uses: gradle/actions/setup-gradle@v4
106+
uses: gradle/actions/setup-gradle@v5
107+
with:
108+
cache-read-only: true
113109

114110
# Run tests
115111
- name: Run Tests
@@ -118,7 +114,7 @@ jobs:
118114
# Collect Tests Result of failed tests
119115
- name: Collect Tests Result
120116
if: ${{ failure() }}
121-
uses: actions/upload-artifact@v4
117+
uses: actions/upload-artifact@v5
122118
with:
123119
name: tests-result
124120
path: ${{ github.workspace }}/build/reports/tests
@@ -128,6 +124,45 @@ jobs:
128124
uses: codecov/codecov-action@v5
129125
with:
130126
files: ${{ github.workspace }}/build/reports/kover/report.xml
127+
token: ${{ secrets.CODECOV_TOKEN }}
128+
129+
# Run Qodana inspections and provide a report
130+
inspectCode:
131+
name: Inspect code
132+
needs: [ build ]
133+
runs-on: ubuntu-latest
134+
permissions:
135+
contents: write
136+
checks: write
137+
pull-requests: write
138+
steps:
139+
140+
# Free GitHub Actions Environment Disk Space
141+
- name: Maximize Build Space
142+
uses: jlumbroso/free-disk-space@v1.3.1
143+
with:
144+
tool-cache: false
145+
large-packages: false
146+
147+
# Check out the current repository
148+
- name: Fetch Sources
149+
uses: actions/checkout@v5
150+
with:
151+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
152+
fetch-depth: 0 # a full history is required for pull request analysis
153+
154+
# Set up the Java environment for the next steps
155+
- name: Setup Java
156+
uses: actions/setup-java@v5
157+
with:
158+
distribution: zulu
159+
java-version: 21
160+
161+
# Run Qodana inspections
162+
- name: Qodana - Code Inspection
163+
uses: JetBrains/qodana-action@v2025.1.1
164+
with:
165+
cache-default-branch-only: true
131166

132167
# Run plugin structure verification along with IntelliJ Plugin Verifier
133168
verify:
@@ -138,59 +173,54 @@ jobs:
138173

139174
# Free GitHub Actions Environment Disk Space
140175
- name: Maximize Build Space
141-
uses: jlumbroso/free-disk-space@main
176+
uses: jlumbroso/free-disk-space@v1.3.1
142177
with:
143178
tool-cache: false
144179
large-packages: false
145180

146181
# Check out the current repository
147182
- name: Fetch Sources
148-
uses: actions/checkout@v4
183+
uses: actions/checkout@v5
149184

150-
# Set up Java environment for the next steps
185+
# Set up the Java environment for the next steps
151186
- name: Setup Java
152-
uses: actions/setup-java@v4
187+
uses: actions/setup-java@v5
153188
with:
154189
distribution: zulu
155190
java-version: 21
156191

157192
# Setup Gradle
158193
- name: Setup Gradle
159-
uses: gradle/actions/setup-gradle@v4
160-
161-
# Cache Plugin Verifier IDEs
162-
- name: Setup Plugin Verifier IDEs Cache
163-
uses: actions/cache@v4
194+
uses: gradle/actions/setup-gradle@v5
164195
with:
165-
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
166-
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
196+
cache-read-only: true
167197

168198
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
169199
- name: Run Plugin Verification tasks
170-
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
200+
run: ./gradlew verifyPlugin
171201

172202
# Collect Plugin Verifier Result
173203
- name: Collect Plugin Verifier Result
174204
if: ${{ always() }}
175-
uses: actions/upload-artifact@v4
205+
uses: actions/upload-artifact@v5
176206
with:
177207
name: pluginVerifier-result
178208
path: ${{ github.workspace }}/build/reports/pluginVerifier
179209

180210
# Prepare a draft release for GitHub Releases page for the manual verification
181-
# If accepted and published, release workflow would be triggered
211+
# If accepted and published, the release workflow would be triggered
182212
releaseDraft:
183213
name: Release draft
184214
if: github.event_name != 'pull_request'
185-
needs: [ build, test, verify ]
215+
needs: [ build, test, inspectCode, verify ]
186216
runs-on: ubuntu-latest
187217
permissions:
188218
contents: write
189219
steps:
190220

191221
# Check out the current repository
192222
- name: Fetch Sources
193-
uses: actions/checkout@v4
223+
uses: actions/checkout@v5
194224

195225
# Remove old release drafts by using the curl request for the available releases with a draft flag
196226
- name: Remove Old Release Drafts
@@ -206,10 +236,11 @@ jobs:
206236
env:
207237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208238
run: |
209-
gh release create "v${{ needs.build.outputs.version }}" \
239+
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
240+
RELEASE_NOTE="./build/tmp/release_note.txt"
241+
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
242+
243+
gh release create $VERSION \
210244
--draft \
211-
--title "v${{ needs.build.outputs.version }}" \
212-
--notes "$(cat << 'EOM'
213-
${{ needs.build.outputs.changelog }}
214-
EOM
215-
)"
245+
--title $VERSION \
246+
--notes-file $RELEASE_NOTE

.github/workflows/release.yml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
2-
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
2+
# Running the publishPlugin task requires all the following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
33
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.
44

55
name: Release
@@ -18,46 +18,43 @@ jobs:
1818
pull-requests: write
1919
steps:
2020

21+
# Free GitHub Actions Environment Disk Space
22+
- name: Maximize Build Space
23+
uses: jlumbroso/free-disk-space@v1.3.1
24+
with:
25+
tool-cache: false
26+
large-packages: false
27+
2128
# Check out the current repository
2229
- name: Fetch Sources
23-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
2431
with:
2532
ref: ${{ github.event.release.tag_name }}
2633

27-
# Set up Java environment for the next steps
34+
# Set up the Java environment for the next steps
2835
- name: Setup Java
29-
uses: actions/setup-java@v4
36+
uses: actions/setup-java@v5
3037
with:
3138
distribution: zulu
3239
java-version: 21
3340

3441
# Setup Gradle
3542
- name: Setup Gradle
36-
uses: gradle/actions/setup-gradle@v4
43+
uses: gradle/actions/setup-gradle@v5
3744
with:
38-
gradle-home-cache-cleanup: true
39-
40-
# Set environment variables
41-
- name: Export Properties
42-
id: properties
43-
shell: bash
44-
run: |
45-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
46-
${{ github.event.release.body }}
47-
EOM
48-
)"
49-
50-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
51-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
52-
echo "EOF" >> $GITHUB_OUTPUT
45+
cache-read-only: true
5346

5447
# Update the Unreleased section with the current release note
5548
- name: Patch Changelog
56-
if: ${{ steps.properties.outputs.changelog != '' }}
49+
if: ${{ github.event.release.body != '' }}
5750
env:
58-
CHANGELOG: ${{ steps.properties.outputs.changelog }}
51+
CHANGELOG: ${{ github.event.release.body }}
5952
run: |
60-
./gradlew patchChangelog --release-note="$CHANGELOG"
53+
RELEASE_NOTE="./build/tmp/release_note.txt"
54+
mkdir -p "$(dirname "$RELEASE_NOTE")"
55+
echo "$CHANGELOG" > $RELEASE_NOTE
56+
57+
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
6158
6259
# Publish the plugin to JetBrains Marketplace
6360
- name: Publish Plugin
@@ -68,15 +65,15 @@ jobs:
6865
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
6966
run: ./gradlew publishPlugin
7067

71-
# Upload artifact as a release asset
68+
# Upload an artifact as a release asset
7269
- name: Upload Release Asset
7370
env:
7471
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7572
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
7673

7774
# Create a pull request
7875
- name: Create Pull Request
79-
if: ${{ steps.properties.outputs.changelog != '' }}
76+
if: ${{ github.event.release.body != '' }}
8077
env:
8178
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8279
run: |
@@ -90,7 +87,7 @@ jobs:
9087
git checkout -b $BRANCH
9188
git commit -am "Changelog update - $VERSION"
9289
git push --set-upstream origin $BRANCH
93-
90+
9491
gh label create "$LABEL" \
9592
--description "Pull requests with release changelog update" \
9693
--force \
@@ -100,4 +97,4 @@ jobs:
10097
--title "Changelog update - \`$VERSION\`" \
10198
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
10299
--label "$LABEL" \
103-
--head $BRANCH
100+
--head $BRANCH

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.idea
33
.intellijPlatform
44
.qodana
5-
build
5+
build
6+
.kotlin

0 commit comments

Comments
 (0)