diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf01d57..48a575d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,9 @@ jobs: java-version: '17' distribution: 'temurin' cache: maven + + - name: Get Version + run: echo "PLUGIN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - name: Build with Maven run: mvn -B package --file pom.xml @@ -37,29 +40,21 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: ${{ env.PLUGIN_FILE }}-1.0.0 - path: target/${{ env.PLUGIN_FILE }}-1.0.0.jar + name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }} + path: target/${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar retention-days: 5 - - name: Send Build Success Notification - if: success() + - name: Send Build Notification + if: always() uses: sarisia/actions-status-discord@v1 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} - title: "✅ Build Success!" - description: "A new build of ${{ env.PLUGIN_NAME }} has been created\nCommit: ${{ github.sha }}" - color: 0x00ff00 - username: "🏺Artifact Build's" - avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" - - - name: Send Build Failed Notification - if: failure() - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - title: "❌ Build Failed!" - description: "The build for ${{ env.PLUGIN_NAME }} has failed\nCommit: ${{ github.sha }}" - color: 0xff0000 + title: "${{ job.status == 'success' && '✅ Build Success!' || '❌ Build Failed!' }}" + description: | + **${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}** + By ${{ github.actor }} • ${{ github.sha }} + ${{ github.repository }} + color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }} username: "🏺Artifact Build's" avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" @@ -74,32 +69,23 @@ jobs: - name: Download Artifact uses: actions/download-artifact@v4 with: - name: ${{ env.PLUGIN_FILE }}-1.0.0 + name: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }} - name: Upload Release uses: softprops/action-gh-release@v2 with: - files: ${{ env.PLUGIN_FILE }}-1.0.0.jar + files: ${{ env.PLUGIN_FILE }}-${{ env.PLUGIN_VERSION }}.jar fail_on_unmatched_files: true - - name: Send Release Success Notification - if: success() + - name: Send Release Notification + if: always() uses: sarisia/actions-status-discord@v1 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} - title: "🎉 Release Published!" - description: "Version 1.0.0 of ${{ env.PLUGIN_NAME }} is now available!\nDownload: https://github.com/${{ github.repository }}/releases/latest" - color: 0x00ff00 - username: "🏺Artifact Build's" - avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" - - - name: Send Release Failed Notification - if: failure() - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - title: "❌ Release Failed!" - description: "The release for ${{ env.PLUGIN_NAME }} has failed\nVersion: 1.0.0" - color: 0xff0000 + title: "${{ job.status == 'success' && '🎉 Release Published!' || '❌ Release Failed!' }}" + description: | + **${{ env.PLUGIN_NAME }} v${{ env.PLUGIN_VERSION }}** + ${{ job.status == 'success' && '➜ https://github.com/${{ github.repository }}/releases/latest' || '' }} + color: ${{ job.status == 'success' && '0x00ff00' || '0xff0000' }} username: "🏺Artifact Build's" avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"