From 29baff888fd4c7afa25bccef1ac828d964f9340c Mon Sep 17 00:00:00 2001 From: T14D3 <73843330+T14D3@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:14:58 +0100 Subject: [PATCH 1/4] Create gradle-publish.yml --- .github/workflows/gradle-publish.yml | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/gradle-publish.yml diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml new file mode 100644 index 0000000..8ece096 --- /dev/null +++ b/.github/workflows/gradle-publish.yml @@ -0,0 +1,42 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a package using Gradle 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#Publishing-using-gradle + +name: Gradle Package + +on: [push] + +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: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Build with Gradle + run: ./gradlew build + + # The USERNAME and TOKEN need to correspond to the credentials environment variables used in + # the publishing section of your build.gradle + - name: Publish to GitHub Packages + run: ./gradlew publish + env: + USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} From aa0b31ef3c62b225956aef151fd21d52f7e5710d Mon Sep 17 00:00:00 2001 From: T14D3 <73843330+T14D3@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:17:52 +0100 Subject: [PATCH 2/4] Fix gradlew file permissions --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From a525860ec1584adc2c5251ab6f170fb94e93b534 Mon Sep 17 00:00:00 2001 From: T14D3 <73843330+T14D3@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:34:03 +0100 Subject: [PATCH 3/4] Gradle publishing task --- build.gradle | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.gradle b/build.gradle index bd29fe9..5087d5d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ import xyz.jpenilla.runtask.task.AbstractRun plugins { id 'java' + id 'maven-publish' id 'io.papermc.paperweight.userdev' version '1.7.3' id 'xyz.jpenilla.run-paper' version '2.3.1' } @@ -66,3 +67,21 @@ tasks { } } +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/t14d3/zones") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + } + } + } + publications { + gpr(MavenPublication) { + from(components.java) + } + } +} + From d6bf4cf6570600060505f0bcf83c135b52f378be Mon Sep 17 00:00:00 2001 From: T14D3 <73843330+T14D3@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:40:30 +0100 Subject: [PATCH 4/4] Lowercase project name/version stuff --- build.gradle | 2 +- settings.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5087d5d..240e34d 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'de.t14d3' -version = '1.0-SNAPSHOT' +version = '1.0' repositories { mavenCentral() diff --git a/settings.gradle b/settings.gradle index b3fe594..590edde 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' } -rootProject.name = 'Zones' +rootProject.name = 'zones'