Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Commit d1f4414

Browse files
authored
Update build.yml
1 parent a6f87c6 commit d1f4414

1 file changed

Lines changed: 22 additions & 36 deletions

File tree

.github/workflows/build.yml

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
java-version: '17'
2828
distribution: 'temurin'
2929
cache: maven
30+
31+
- name: Get Version
32+
run: echo "PLUGIN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
3033

3134
- name: Build with Maven
3235
run: mvn -B package --file pom.xml
@@ -37,29 +40,21 @@ jobs:
3740
- name: Upload Artifact
3841
uses: actions/upload-artifact@v4
3942
with:
40-
name: ${{ env.PLUGIN_FILE }}-1.0.0
41-
path: target/${{ env.PLUGIN_FILE }}-1.0.0.jar
43+
name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}
44+
path: target/${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar
4245
retention-days: 5
4346

44-
- name: Send Build Success Notification
45-
if: success()
46-
uses: sarisia/actions-status-discord@v1
47-
with:
48-
webhook: ${{ secrets.DISCORD_WEBHOOK }}
49-
title: "✅ Build Success!"
50-
description: "A new build of ${{ env.PLUGIN_NAME }} has been created\nCommit: ${{ github.sha }}"
51-
color: 0x00ff00
52-
username: "🏺Artifact Build's"
53-
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
54-
55-
- name: Send Build Failed Notification
56-
if: failure()
47+
- name: Send Build Notification
48+
if: always()
5749
uses: sarisia/actions-status-discord@v1
5850
with:
5951
webhook: ${{ secrets.DISCORD_WEBHOOK }}
60-
title: "❌ Build Failed!"
61-
description: "The build for ${{ env.PLUGIN_NAME }} has failed\nCommit: ${{ github.sha }}"
62-
color: 0xff0000
52+
title: "${{ job.status == 'success' && '✅ Build Success!' || '❌ Build Failed!' }}"
53+
description: |
54+
**${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}**
55+
By ${{ github.actor }} • ${{ github.sha }}
56+
${{ github.repository }}
57+
color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }}
6358
username: "🏺Artifact Build's"
6459
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
6560

@@ -74,32 +69,23 @@ jobs:
7469
- name: Download Artifact
7570
uses: actions/download-artifact@v4
7671
with:
77-
name: ${{ env.PLUGIN_FILE }}-1.0.0
72+
name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}
7873

7974
- name: Upload Release
8075
uses: softprops/action-gh-release@v2
8176
with:
82-
files: ${{ env.PLUGIN_FILE }}-1.0.0.jar
77+
files: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar
8378
fail_on_unmatched_files: true
8479

85-
- name: Send Release Success Notification
86-
if: success()
87-
uses: sarisia/actions-status-discord@v1
88-
with:
89-
webhook: ${{ secrets.DISCORD_WEBHOOK }}
90-
title: "🎉 Release Published!"
91-
description: "Version 1.0.0 of ${{ env.PLUGIN_NAME }} is now available!\nDownload: https://github.com/${{ github.repository }}/releases/latest"
92-
color: 0x00ff00
93-
username: "🏺Artifact Build's"
94-
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
95-
96-
- name: Send Release Failed Notification
97-
if: failure()
80+
- name: Send Release Notification
81+
if: always()
9882
uses: sarisia/actions-status-discord@v1
9983
with:
10084
webhook: ${{ secrets.DISCORD_WEBHOOK }}
101-
title: "❌ Release Failed!"
102-
description: "The release for ${{ env.PLUGIN_NAME }} has failed\nVersion: 1.0.0"
103-
color: 0xff0000
85+
title: "${{ job.status == 'success' && '🎉 Release Published!' || '❌ Release Failed!' }}"
86+
description: |
87+
**${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}**
88+
${{ job.status == 'success' && '➜ https://github.com/${{ github.repository }}/releases/latest' || '' }}
89+
color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }}
10490
username: "🏺Artifact Build's"
10591
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"

0 commit comments

Comments
 (0)