Skip to content

Commit 1a5afae

Browse files
committed
chore: Update IntelliJ Platform 2.3.1
1 parent f640b39 commit 1a5afae

File tree

10 files changed

+184
-247
lines changed

10 files changed

+184
-247
lines changed

.github/workflows/build.yml

Lines changed: 83 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,45 @@
11
name: Build
22
on:
3+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
34
push:
4-
tags:
5-
- 'v*'
5+
branches: [ main ]
6+
# Trigger the workflow on any pull request
7+
pull_request:
68

79
concurrency:
8-
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
911
cancel-in-progress: true
1012

1113
jobs:
14+
15+
# Prepare the environment and build the plugin
1216
build:
1317
name: Build
1418
runs-on: ubuntu-latest
15-
outputs:
16-
version: ${{ steps.properties.outputs.version }}
17-
changelog: ${{ steps.properties.outputs.changelog }}
1819
steps:
20+
1921
# Free GitHub Actions Environment Disk Space
2022
- name: Maximize Build Space
2123
uses: jlumbroso/[email protected]
2224
with:
2325
tool-cache: false
2426
large-packages: false
2527

26-
# Check out current repository
28+
# Check out the current repository
2729
- name: Fetch Sources
2830
uses: actions/checkout@v4
29-
with:
30-
submodules: 'true'
31-
token: ${{ secrets.FETCH_SUBMODULES_PAT }}
3231

33-
- name: Remove .updates file
34-
run: |
35-
rm -f src/main/resources/bitrix-idea-library/.updates
36-
37-
# Validate wrapper
38-
- name: Gradle Wrapper Validation
39-
uses: gradle/actions/wrapper-validation@v3
40-
41-
# Setup Java environment for the next steps
32+
# Set up the Java environment for the next steps
4233
- name: Setup Java
4334
uses: actions/setup-java@v4
4435
with:
4536
distribution: zulu
4637
java-version: 21
4738

48-
# Setup Java environment for the next steps
39+
# Setup Gradle
4940
- name: Setup Gradle
5041
uses: gradle/actions/setup-gradle@v4
5142

52-
# Set environment variables
53-
- name: Export Properties
54-
id: properties
55-
shell: bash
56-
run: |
57-
PROPERTIES="$(./gradlew properties --console=plain -q)"
58-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
59-
CHANGELOG="$(./gradlew getChangelog --console=plain -q)"
60-
61-
echo "version=$VERSION" >> $GITHUB_OUTPUT
62-
63-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
64-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
65-
echo "EOF" >> $GITHUB_OUTPUT
66-
6743
# Build plugin
6844
- name: Build plugin
6945
run: ./gradlew buildPlugin
@@ -79,31 +55,32 @@ jobs:
7955
8056
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
8157
82-
# Store already-built plugin as an artifact for downloading
58+
# Store an already-built plugin as an artifact for downloading
8359
- name: Upload artifact
8460
uses: actions/upload-artifact@v4
8561
with:
8662
name: ${{ steps.artifact.outputs.filename }}
8763
path: ./build/distributions/content/*/*
88-
64+
8965
# Run tests and upload a code coverage report
9066
test:
9167
name: Test
92-
needs: build
68+
needs: [ build ]
9369
runs-on: ubuntu-latest
9470
steps:
71+
9572
# Free GitHub Actions Environment Disk Space
9673
- name: Maximize Build Space
9774
uses: jlumbroso/[email protected]
9875
with:
9976
tool-cache: false
10077
large-packages: false
10178

102-
# Check out current repository
79+
# Check out the current repository
10380
- name: Fetch Sources
10481
uses: actions/checkout@v4
105-
106-
# Setup Java environment for the next steps
82+
83+
# Set up the Java environment for the next steps
10784
- name: Setup Java
10885
uses: actions/setup-java@v4
10986
with:
@@ -128,30 +105,70 @@ jobs:
128105
name: tests-result
129106
path: ${{ github.workspace }}/build/reports/tests
130107

131-
# Upload Kover report to CodeCov
108+
# Upload the Kover report to CodeCov
132109
- name: Upload Code Coverage Report
133-
uses: codecov/codecov-action@v3
110+
uses: codecov/codecov-action@v5
134111
with:
135112
files: ${{ github.workspace }}/build/reports/kover/report.xml
136-
113+
token: ${{ secrets.CODECOV_TOKEN }}
114+
115+
# Run Qodana inspections and provide a report
116+
inspectCode:
117+
name: Inspect code
118+
needs: [ build ]
119+
runs-on: ubuntu-latest
120+
permissions:
121+
contents: write
122+
checks: write
123+
pull-requests: write
124+
steps:
125+
126+
# Free GitHub Actions Environment Disk Space
127+
- name: Maximize Build Space
128+
uses: jlumbroso/[email protected]
129+
with:
130+
tool-cache: false
131+
large-packages: false
132+
133+
# Check out the current repository
134+
- name: Fetch Sources
135+
uses: actions/checkout@v4
136+
with:
137+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
138+
fetch-depth: 0 # a full history is required for pull request analysis
139+
140+
# Set up the Java environment for the next steps
141+
- name: Setup Java
142+
uses: actions/setup-java@v4
143+
with:
144+
distribution: zulu
145+
java-version: 21
146+
147+
# Run Qodana inspections
148+
- name: Qodana - Code Inspection
149+
uses: JetBrains/[email protected]
150+
with:
151+
cache-default-branch-only: true
152+
137153
# Run plugin structure verification along with IntelliJ Plugin Verifier
138154
verify:
139155
name: Verify plugin
140-
needs: build
156+
needs: [ build ]
141157
runs-on: ubuntu-latest
142158
steps:
159+
143160
# Free GitHub Actions Environment Disk Space
144161
- name: Maximize Build Space
145162
uses: jlumbroso/[email protected]
146163
with:
147164
tool-cache: false
148165
large-packages: false
149166

150-
# Check out current repository
167+
# Check out the current repository
151168
- name: Fetch Sources
152169
uses: actions/checkout@v4
153-
154-
# Setup Java environment for the next steps
170+
171+
# Set up the Java environment for the next steps
155172
- name: Setup Java
156173
uses: actions/setup-java@v4
157174
with:
@@ -161,10 +178,6 @@ jobs:
161178
# Setup Gradle
162179
- name: Setup Gradle
163180
uses: gradle/actions/setup-gradle@v4
164-
165-
# Cache Plugin Verifier IDEs
166-
- name: Setup Plugin Verifier IDEs Cache
167-
uses: actions/cache@v4
168181
with:
169182
cache-read-only: true
170183

@@ -181,15 +194,21 @@ jobs:
181194
path: ${{ github.workspace }}/build/reports/pluginVerifier
182195

183196
# Prepare a draft release for GitHub Releases page for the manual verification
184-
# If accepted and published, release workflow would be triggered
197+
# If accepted and published, the release workflow would be triggered
185198
releaseDraft:
186-
name: Release Draft
187-
needs: build
199+
name: Release draft
200+
if: github.event_name != 'pull_request'
201+
needs: [ build, test, inspectCode, verify ]
188202
runs-on: ubuntu-latest
189203
permissions:
190204
contents: write
191205
steps:
192-
# Remove old release drafts by using the curl request for the available releases with draft flag
206+
207+
# Check out the current repository
208+
- name: Fetch Sources
209+
uses: actions/checkout@v4
210+
211+
# Remove old release drafts by using the curl request for the available releases with a draft flag
193212
- name: Remove Old Release Drafts
194213
env:
195214
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -198,17 +217,16 @@ jobs:
198217
--jq '.[] | select(.draft == true) | .id' \
199218
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
200219
201-
# Create new release draft - which is not publicly visible and requires manual acceptance
220+
# Create a new release draft which is not publicly visible and requires manual acceptance
202221
- name: Create Release Draft
203222
env:
204223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
205224
run: |
206-
gh release create "${{ needs.build.outputs.version }}"" \
225+
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
226+
RELEASE_NOTE="./build/tmp/release_note.txt"
227+
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
228+
229+
gh release create $VERSION \
207230
--draft \
208-
--title "${{ needs.build.outputs.version }}""
209-
210-
# Upload artifact as a release asset
211-
- name: Upload Release Asset
212-
env:
213-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214-
run: gh release upload ${{ needs.build.outputs.version }}" ./build/distributions/*
231+
--title $VERSION \
232+
--notes-file $RELEASE_NOTE

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [prereleased, released]
5+
6+
jobs:
7+
release:
8+
name: Publish Plugin
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
steps:
14+
- name: Maximize Build Space
15+
uses: jlumbroso/[email protected]
16+
with:
17+
tool-cache: false
18+
large-packages: false
19+
20+
# Check out the current repository
21+
- name: Fetch Sources
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.release.tag_name }}
25+
26+
# Set up the Java environment for the next steps
27+
- name: Setup Java
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: zulu
31+
java-version: 21
32+
33+
# Setup Gradle
34+
- name: Setup Gradle
35+
uses: gradle/actions/setup-gradle@v4
36+
with:
37+
cache-read-only: true
38+
39+
# Update the Unreleased section with the current release note
40+
- name: Patch Changelog
41+
if: ${{ github.event.release.body != '' }}
42+
env:
43+
CHANGELOG: ${{ github.event.release.body }}
44+
run: |
45+
RELEASE_NOTE="./build/tmp/release_note.txt"
46+
mkdir -p "$(dirname "$RELEASE_NOTE")"
47+
echo "$CHANGELOG" > $RELEASE_NOTE
48+
49+
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
50+
51+
# Publish the plugin to JetBrains Marketplace
52+
- name: Publish Plugin
53+
env:
54+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
55+
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
56+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
57+
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
58+
run: ./gradlew publishPlugin
59+
60+
# Upload an artifact as a release asset
61+
- name: Upload Release Asset
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
65+
66+
# Create a pull request
67+
- name: Create Pull Request
68+
if: ${{ steps.properties.outputs.changelog != '' }}
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
VERSION="${{ github.event.release.tag_name }}"
73+
BRANCH="changelog-update-$VERSION"
74+
LABEL="release changelog"
75+
76+
git config user.email "[email protected]"
77+
git config user.name "GitHub Action"
78+
79+
git checkout -b $BRANCH
80+
git commit -am "Changelog update - $VERSION"
81+
git push --set-upstream origin $BRANCH
82+
83+
gh label create "$LABEL" \
84+
--description "Pull requests with release changelog update" \
85+
--force \
86+
|| true
87+
88+
gh pr create \
89+
--title "Changelog update - \`$VERSION\`" \
90+
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
91+
--label "$LABEL" \
92+
--head $BRANCH

0 commit comments

Comments
 (0)