mirror of
https://github.com/KoopaCode/LifeSteal-Core.git
synced 2025-04-02 06:47:32 +00:00
Create build.yml
This commit is contained in:
parent
4c0b4be5e3
commit
ac47f50071
83
.github/workflows/maven-publish.yml
vendored
Normal file
83
.github/workflows/maven-publish.yml
vendored
Normal 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"
|
Loading…
x
Reference in New Issue
Block a user