Create build.yml

This commit is contained in:
Koopa 2025-01-31 20:42:38 -05:00 committed by GitHub
parent 4c0b4be5e3
commit ac47f50071
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

83
.github/workflows/maven-publish.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: Build
env:
PLUGIN_NAME: Lifesteal Core
PLUGIN_FILE: lifesteal-core
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Copy JAR to root
run: cp target/${{ env.PLUGIN_FILE }}-*.jar ${{ env.PLUGIN_FILE }}.jar
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PLUGIN_FILE }}
path: ${{ env.PLUGIN_FILE }}.jar
compression-level: 0
retention-days: 5
- name: Send Discord Notification
if: success()
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "New Build Available!"
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"
release:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.PLUGIN_FILE }}
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PLUGIN_FILE }}.jar
- name: Send Release Discord Notification
if: success()
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "🎉 New Release Published!"
description: "A new release of ${{ env.PLUGIN_NAME }} is 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"