From d6aca8a50ee41aea6b9808aeb1b3441a9ffabd59 Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Tue, 10 Sep 2024 21:32:07 -0300 Subject: [PATCH] Added stuff --- .github/workflows/maven-publish.yml | 59 +++++++++++++++++++++++++++++ pom.xml | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..f30a027 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,59 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Upload JAR as artifact + uses: actions/upload-artifact@v4 + with: + name: plugin-jar + path: target/*.jar # Path to the JAR in the target directory + + push-jar-to-repo: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Commit JAR file + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + cp target/*.jar . + git add *.jar + git commit -m "Add built JAR file" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index 22c6591..4a98149 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ org.bukkit bukkit - 1.15.2-R0.1-SNAPSHOT + 1.20.5-R0.1-SNAPSHOT provided