From a57c4fbb4382b1bd614703f6ee7867c32c28ecd6 Mon Sep 17 00:00:00 2001 From: modmuss Date: Sun, 3 Mar 2024 16:33:34 +0000 Subject: [PATCH] Publish to maven central (#127) --- .github/workflows/release.yml | 7 ++++++- build.gradle | 22 ++++++++++++++++++++++ settings.gradle | 10 ++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48aacde37..319e54748 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,4 +13,9 @@ jobs: env: MAVEN_URL: ${{ secrets.MAVEN_URL }} MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} \ No newline at end of file + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_CENTRAL_URL: ${{ secrets.MAVEN_CENTRAL_URL }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + SIGNING_SERVER: ${{ secrets.SIGNING_SERVER }} + SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 75b811836..d12a0ad56 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,10 @@ buildscript { } } +plugins { + id "me.modmuss50.remotesign" version "0.4.0" +} + import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar // Apply plugin @@ -505,9 +509,27 @@ publishing { } } } + + if (ENV.MAVEN_CENTRAL_URL) { + repositories.maven { + name "central" + url ENV.MAVEN_CENTRAL_URL + credentials { + username ENV.MAVEN_CENTRAL_USERNAME + password ENV.MAVEN_CENTRAL_PASSWORD + } + } + } } } +remoteSign { + requestUrl = ENV.SIGNING_SERVER + pgpAuthKey = ENV.SIGNING_PGP_KEY + useDummyForTesting = ENV.SIGNING_SERVER == null + sign publishing.publications.developer +} + // A task to ensure that the version being released has not already been released. task checkVersion { doFirst { diff --git a/settings.gradle b/settings.gradle index 89f411069..5ba47c529 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,11 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + } +} + rootProject.name = name