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

Commit a4f3135

Browse files
committed
Update build.yml
1 parent d0479e0 commit a4f3135

1 file changed

Lines changed: 22 additions & 89 deletions

File tree

.github/workflows/build.yml

Lines changed: 22 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
name: Build
2-
env:
3-
PLUGIN_NAME: NoBullying
4-
PLUGIN_FILE: nobullying
5-
62
on:
73
push:
84
branches: [ "main" ]
@@ -27,6 +23,12 @@ jobs:
2723
java-version: '17'
2824
distribution: 'temurin'
2925
cache: maven
26+
27+
- name: Get Project Info
28+
run: |
29+
echo "PLUGIN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
30+
echo "PLUGIN_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)" >> $GITHUB_ENV
31+
echo "PLUGIN_FILE=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV
3032
3133
- name: Build with Maven
3234
run: mvn -B package --file pom.xml
@@ -37,55 +39,21 @@ jobs:
3739
- name: Upload Artifact
3840
uses: actions/upload-artifact@v4
3941
with:
40-
name: ${{ env.PLUGIN_FILE }}-1.0.0
41-
path: target/${{ env.PLUGIN_FILE }}-1.0.0.jar
42+
name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}
43+
path: target/${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar
4244
retention-days: 5
4345

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: "Success: ✅ Build Success!"
50-
description: |
51-
A new build of ${{ env.PLUGIN_NAME }} has been created
52-
53-
**Repository**
54-
${{ github.repository }}
55-
56-
**Event - ${{ github.event_name }}**
57-
${{ github.sha }} Update build.yml
58-
59-
**Triggered by**
60-
${{ github.actor }}
61-
62-
**Workflow**
63-
Build
64-
color: 0x00ff00
65-
username: "🏺Artifact Build's"
66-
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
67-
68-
- name: Send Build Failed Notification
69-
if: failure()
46+
- name: Send Build Notification
47+
if: always()
7048
uses: sarisia/actions-status-discord@v1
7149
with:
7250
webhook: ${{ secrets.DISCORD_WEBHOOK }}
73-
title: "Error: ❌ Build Failed!"
51+
title: "${{ job.status == 'success' && '✅ Build Success!' || '❌ Build Failed!' }}"
7452
description: |
75-
The build for ${{ env.PLUGIN_NAME }} has failed
76-
77-
**Repository**
53+
**${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}**
54+
By ${{ github.actor }} • ${{ github.sha }}
7855
${{ github.repository }}
79-
80-
**Event - ${{ github.event_name }}**
81-
${{ github.sha }} Update build.yml
82-
83-
**Triggered by**
84-
${{ github.actor }}
85-
86-
**Workflow**
87-
Build
88-
color: 0xff0000
56+
color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }}
8957
username: "🏺Artifact Build's"
9058
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
9159

@@ -100,58 +68,23 @@ jobs:
10068
- name: Download Artifact
10169
uses: actions/download-artifact@v4
10270
with:
103-
name: ${{ env.PLUGIN_FILE }}-1.0.0
71+
name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}
10472

10573
- name: Upload Release
10674
uses: softprops/action-gh-release@v2
10775
with:
108-
files: ${{ env.PLUGIN_FILE }}-1.0.0.jar
76+
files: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar
10977
fail_on_unmatched_files: true
11078

111-
- name: Send Release Success Notification
112-
if: success()
79+
- name: Send Release Notification
80+
if: always()
11381
uses: sarisia/actions-status-discord@v1
11482
with:
11583
webhook: ${{ secrets.DISCORD_WEBHOOK }}
116-
title: "Success: 🎉 Release Published!"
84+
title: "${{ job.status == 'success' && '🎉 Release Published!' || '❌ Release Failed!' }}"
11785
description: |
118-
Version 1.0.0 of ${{ env.PLUGIN_NAME }} is now available!
119-
120-
**Download**
121-
https://github.com/${{ github.repository }}/releases/latest
122-
123-
**Repository**
124-
${{ github.repository }}
125-
126-
**Event - Release**
127-
${{ github.ref_name }}
128-
129-
**Published by**
130-
${{ github.actor }}
131-
color: 0x00ff00
132-
username: "🏺Artifact Build's"
133-
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
134-
135-
- name: Send Release Failed Notification
136-
if: failure()
137-
uses: sarisia/actions-status-discord@v1
138-
with:
139-
webhook: ${{ secrets.DISCORD_WEBHOOK }}
140-
title: "Error: ❌ Release Failed!"
141-
description: |
142-
The release for ${{ env.PLUGIN_NAME }} has failed
143-
144-
**Version**
145-
1.0.0
146-
147-
**Repository**
148-
${{ github.repository }}
149-
150-
**Event - Release**
151-
${{ github.ref_name }}
152-
153-
**Attempted by**
154-
${{ github.actor }}
155-
color: 0xff0000
86+
**${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}**
87+
${{ job.status == 'success' && '➜ https://github.com/${{ github.repository }}/releases/latest' || '' }}
88+
color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }}
15689
username: "🏺Artifact Build's"
15790
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"

0 commit comments

Comments
 (0)