From 12709c9ab3a6ad9eaf16b0dc2e8dce8819f399ca Mon Sep 17 00:00:00 2001 From: Kodehawa Date: Wed, 27 Dec 2023 03:52:38 -0300 Subject: [PATCH] Add: maven central publishing --- .github/workflows/build.yml | 5 +++++ build.gradle | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a85070..9ede61c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,3 +25,8 @@ jobs: if: github.event_name == 'release' && github.event.action == 'created' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: ./gradlew publishToSonatype + if: github.event_name == 'release' && github.event.action == 'created' + env: + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }} diff --git a/build.gradle b/build.gradle index 2180bfb..0f361f0 100644 --- a/build.gradle +++ b/build.gradle @@ -2,13 +2,14 @@ plugins { id 'com.jfrog.bintray' version '1.8.5' id 'java' id 'maven-publish' + id("io.github.gradle-nexus.publish-plugin") version "1.3.0" id 'com.github.johnrengelman.shadow' version '7.0.0' } import org.apache.tools.ant.filters.ReplaceTokens def versionObj = new Version(major: 2, minor: 6, revision: "1.1") -group 'net.kodehawa' +group 'io.github.kodehawa' version "$versionObj" apply plugin: 'java' @@ -74,6 +75,17 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir } +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + username = System.getenv("SONATYPE_USER") + password = System.getenv("SONATYPE_PASS") + } + } +} + publishing { repositories { maven { @@ -86,10 +98,6 @@ publishing { } } publications { - gprSnapshot(MavenPublication) { - version = project.version + "-SNAPSHOT" - from(components.java) - } gpr(MavenPublication) { from(components.java) }