Skip to content

Commit bc36d11

Browse files
authored
GH-1043 Enhance Java CI to comment PR with test build (#1043)
* Enhance Java CI to comment PR with test build * Fix github flavored info alert. * Fix. * Update gradle.yml * Update gradle.yml
1 parent 3b083ed commit bc36d11

File tree

1 file changed

+58
-12
lines changed

1 file changed

+58
-12
lines changed

.github/workflows/gradle.yml

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,83 @@ on:
55
branches:
66
- master
77
pull_request:
8+
types: [opened, synchronize, reopened]
89

910
jobs:
1011
build:
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
14-
java:
15-
- 17
15+
java: [17]
1616
fail-fast: false
17+
1718
steps:
19+
- name: Find existing comment
20+
uses: peter-evans/find-comment@v3
21+
if: github.event_name == 'pull_request'
22+
id: find-comment
23+
with:
24+
issue-number: ${{ github.event.pull_request.number }}
25+
comment-author: 'github-actions[bot]'
26+
27+
- name: Set progress comment
28+
uses: peter-evans/create-or-update-comment@v4
29+
if: github.event_name == 'pull_request'
30+
id: update-progress
31+
with:
32+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
33+
issue-number: ${{ github.event.pull_request.number }}
34+
body: |
35+
### 🚧 Build in progress...
36+
37+
> [!NOTE]
38+
> A new commit has been pushed. A development build of **EternalCore** will be available here once the workflow completes.
39+
edit-mode: replace
40+
1841
- name: Checkout
1942
uses: actions/[email protected]
20-
- name: 'Set up JDK ${{ matrix.java }}'
43+
44+
- name: Set up JDK ${{ matrix.java }}
2145
uses: actions/[email protected]
2246
with:
2347
distribution: adopt
24-
java-version: '${{ matrix.java }}'
48+
java-version: ${{ matrix.java }}
49+
2550
- name: Cache Gradle
2651
uses: actions/[email protected]
2752
with:
2853
path: ~/.gradle/caches
2954
key: >-
30-
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*',
31-
'**/gradle-wrapper.properties') }}
55+
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
3256
restore-keys: '${{ runner.os }}-gradle-'
33-
- name: Grant execute permission for gradlew
57+
58+
- name: Make gradlew executable
3459
run: chmod +x gradlew
35-
- name: Build the Jar
36-
run: './gradlew clean eternalcore-plugin:shadowJar'
37-
- name: Upload a Build Artifact
60+
61+
- name: Build the plugin
62+
run: ./gradlew clean eternalcore-plugin:shadowJar
63+
64+
- name: Upload built JAR
3865
uses: actions/[email protected]
66+
id: upload-artifact
3967
with:
40-
name: 'EternalCore'
41-
path: eternalcore-plugin/build/libs/EternalCore*.jar
68+
name: EternalCore Dev Build
69+
path: eternalcore-plugin/build/libs/EternalCore*.jar
70+
retention-days: 14
71+
overwrite: true
72+
73+
- name: Update comment with download link
74+
uses: peter-evans/create-or-update-comment@v4
75+
if: github.event_name == 'pull_request'
76+
with:
77+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
78+
body: |
79+
### 📦 Development Build Ready
80+
81+
> [!WARNING]
82+
> **Do not use this build in production.** It is for testing purposes only and may be unstable.
83+
84+
👉 [**Click here to download the JAR**](${{ steps.upload-artifact.outputs.artifact-url }})
85+
86+
edit-mode: replace
87+
reactions: rocket

0 commit comments

Comments
 (0)