1
- # GitHub Actions Workflow created for testing and preparing the plugin release in 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.
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 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
12
#
13
13
# # JBIJPPTPL
14
14
15
15
name : Build
16
16
on :
17
- # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
17
+ # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
18
18
push :
19
- branches : [main]
19
+ branches : [ main, develop ]
20
20
# Trigger the workflow on any pull request
21
21
pull_request :
22
22
23
+ concurrency :
24
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25
+ cancel-in-progress : true
26
+
23
27
jobs :
24
-
25
- # Run Gradle Wrapper Validation Action to verify the wrapper's checksum
26
- # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
27
- # Build plugin and provide the artifact for the next workflow jobs
28
+
29
+ # Prepare environment and build the plugin
28
30
build :
29
31
name : Build
30
32
runs-on : ubuntu-latest
31
33
outputs :
32
34
version : ${{ steps.properties.outputs.version }}
33
35
changelog : ${{ steps.properties.outputs.changelog }}
36
+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
34
37
steps :
35
-
38
+
36
39
# Check out current repository
37
40
- name : Fetch Sources
38
- uses : actions/checkout@v2.4.0
39
-
41
+ uses : actions/checkout@v4
42
+
40
43
# Validate wrapper
41
44
- name : Gradle Wrapper Validation
42
- uses : gradle/wrapper-validation-action@v1.0.4
43
-
44
- # Setup Java 11 environment for the next steps
45
+ uses : gradle/wrapper-validation-action@v2
46
+
47
+ # Set up Java environment for the next steps
45
48
- name : Setup Java
46
- uses : actions/setup-java@v2
49
+ uses : actions/setup-java@v4
47
50
with :
48
51
distribution : zulu
49
- java-version : 11
50
- cache : gradle
51
-
52
+ java-version : 17
53
+
54
+ # Setup Gradle
55
+ - name : Setup Gradle
56
+ uses : gradle/actions/setup-gradle@v3
57
+ with :
58
+ gradle-home-cache-cleanup : true
59
+
52
60
# Set environment variables
53
61
- name : Export Properties
54
62
id : properties
55
63
shell : bash
56
64
run : |
57
65
PROPERTIES="$(./gradlew properties --console=plain -q)"
58
66
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
59
- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
60
67
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
61
- CHANGELOG="${CHANGELOG//'%'/'%25'}"
62
- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
63
- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
64
68
65
- echo "::set-output name=version::$VERSION"
66
- echo "::set-output name=name::$NAME"
67
- echo "::set-output name=changelog::$CHANGELOG"
68
- echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
69
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
70
+ echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
71
+
72
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
73
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
74
+ echo "EOF" >> $GITHUB_OUTPUT
69
75
70
76
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
71
-
72
- # Run tests
73
- - name : Run Tests
74
- run : ./gradlew test
75
-
76
- # Collect Tests Result of failed tests
77
- - name : Collect Tests Result
78
- if : ${{ failure() }}
79
- uses : actions/upload-artifact@v2
80
- with :
81
- name : tests-result
82
- path : ${{ github.workspace }}/build/reports/tests
83
-
84
- # # Cache Plugin Verifier IDEs
85
- # - name: Setup Plugin Verifier IDEs Cache
86
-
87
- # with:
88
- # path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
89
- # key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
90
- #
91
- # # Run Verify Plugin task and IntelliJ Plugin Verifier tool
92
- # - name: Run Plugin Verification tasks
93
- # run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
94
- #
95
- # # Collect Plugin Verifier Result
96
- # - name: Collect Plugin Verifier Result
97
- # if: ${{ always() }}
98
- # uses: actions/upload-artifact@v2
99
- # with:
100
- # name: pluginVerifier-result
101
- # path: ${{ github.workspace }}/build/reports/pluginVerifier
102
-
103
- # TODO: temp needed because verifier disabled
104
- - run : ./gradlew buildPlugin
105
-
77
+
78
+ # Build plugin
79
+ - name : Build plugin
80
+ run : ./gradlew buildPlugin
81
+
106
82
# Prepare plugin archive content for creating artifact
107
83
- name : Prepare Plugin Artifact
108
84
id : artifact
@@ -112,43 +88,95 @@ jobs:
112
88
FILENAME=`ls *.zip`
113
89
unzip "$FILENAME" -d content
114
90
115
- echo "::set-output name= filename:: ${FILENAME:0:-4}"
116
-
91
+ echo "filename= ${FILENAME:0:-4}" >> $GITHUB_OUTPUT
92
+
117
93
# Store already-built plugin as an artifact for downloading
118
94
- name : Upload artifact
119
- uses : actions/upload-artifact@v2.2.4
95
+ uses : actions/upload-artifact@v4
120
96
with :
121
97
name : ${{ steps.artifact.outputs.filename }}
122
98
path : ./build/distributions/content/*/*
123
-
99
+
100
+ # Run plugin structure verification along with IntelliJ Plugin Verifier
101
+ verify :
102
+ name : Verify plugin
103
+ needs : [ build ]
104
+ runs-on : ubuntu-latest
105
+ steps :
106
+
107
+ # Free GitHub Actions Environment Disk Space
108
+ - name : Maximize Build Space
109
+ uses : jlumbroso/free-disk-space@main
110
+ with :
111
+ tool-cache : false
112
+ large-packages : false
113
+
114
+ # Check out current repository
115
+ - name : Fetch Sources
116
+ uses : actions/checkout@v4
117
+
118
+ # Set up Java environment for the next steps
119
+ - name : Setup Java
120
+ uses : actions/setup-java@v4
121
+ with :
122
+ distribution : zulu
123
+ java-version : 17
124
+
125
+ # Setup Gradle
126
+ - name : Setup Gradle
127
+ uses : gradle/actions/setup-gradle@v3
128
+ with :
129
+ gradle-home-cache-cleanup : true
130
+
131
+ # Cache Plugin Verifier IDEs
132
+ - name : Setup Plugin Verifier IDEs Cache
133
+ uses : actions/cache@v4
134
+ with :
135
+ path : ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
136
+ key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
137
+
138
+ # Run Verify Plugin task and IntelliJ Plugin Verifier tool
139
+ - name : Run Plugin Verification tasks
140
+ run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
141
+
142
+ # Collect Plugin Verifier Result
143
+ - name : Collect Plugin Verifier Result
144
+ if : ${{ always() }}
145
+ uses : actions/upload-artifact@v4
146
+ with :
147
+ name : pluginVerifier-result
148
+ path : ${{ github.workspace }}/build/reports/pluginVerifier
149
+
124
150
# Prepare a draft release for GitHub Releases page for the manual verification
125
151
# If accepted and published, release workflow would be triggered
126
152
releaseDraft :
127
- name : Release Draft
153
+ name : Release draft
128
154
if : github.event_name != 'pull_request'
129
- needs : build
155
+ needs : [ build, test, inspectCode, verify ]
130
156
runs-on : ubuntu-latest
157
+ permissions :
158
+ contents : write
131
159
steps :
132
-
160
+
133
161
# Check out current repository
134
162
- name : Fetch Sources
135
- uses : actions/checkout@v2.4.0
136
-
137
- # Remove old release drafts by using the curl request for the available releases with draft flag
163
+ uses : actions/checkout@v4
164
+
165
+ # Remove old release drafts by using the curl request for the available releases with a draft flag
138
166
- name : Remove Old Release Drafts
139
167
env :
140
168
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141
169
run : |
142
170
gh api repos/{owner}/{repo}/releases \
143
171
--jq '.[] | select(.draft == true) | .id' \
144
172
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
145
-
146
- # Create new release draft - which is not publicly visible and requires manual acceptance
173
+
174
+ # Create a new release draft which is not publicly visible and requires manual acceptance
147
175
- name : Create Release Draft
148
176
env :
149
177
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150
178
run : |
151
- gh release create v${{ needs.build.outputs.version }} \
179
+ gh release create " v${{ needs.build.outputs.version }}" \
152
180
--draft \
153
181
--title "v${{ needs.build.outputs.version }}" \
154
182
--notes "$(cat << 'EOM'
0 commit comments