From 96356dda81ea4b0dab3d0bb0b96d2f18fca86294 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Fri, 10 Jul 2026 19:53:41 +0200 Subject: [PATCH 1/5] feat(gradle): add description, pom, and signing plugin configuration for maven central publishing --- build.gradle.kts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 049d8f3..d588cc4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ import java.time.Year plugins { java + signing `maven-publish` alias(libs.plugins.indraLicenserSpotless) } @@ -10,6 +11,7 @@ val javaVersion = 25 group = "net.hypejet" version = "1.0-SNAPSHOT" +description = "A Java library making modular programming easier" repositories { mavenCentral() @@ -42,10 +44,39 @@ publishing { publications { create("maven") { from(components["java"]) + + pom { + url = "https://github.com/Hypejet/Modules" + + licenses { + license { + name = "The Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + + developers { + developer { + id = "Codestech1" + name = "Codestech" + email = "codestech@hypejet.net" + } + } + + scm { + connection = "scm:git:git://github.com/Hypejet/Modules.git" + developerConnection = "scm:git:ssh://github.com:Hypejet/Modules.git" + url = "https://github.com/Hypejet/Modules" + } + } } } } +signing { + sign(publishing.publications["maven"]) +} + indraSpotlessLicenser { licenseHeaderFile(rootProject.file("LICENSE_HEADER")) property("YEAR", Year.now().value.toString()) From c81e2026a1d03133c38f021e569fae4a8f795c67 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:27:13 +0200 Subject: [PATCH 2/5] feat(gradle): enable Javadoc "html5" option and make the signing plugin use project properties --- build.gradle.kts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index d588cc4..0f0dbf3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,6 +35,12 @@ tasks { compileJava { options.release = javaVersion } + + javadoc { + val docletOptions = options as StandardJavadocDocletOptions + docletOptions.addBooleanOption("html5", true) + } + test { useJUnitPlatform() } @@ -74,6 +80,11 @@ publishing { } signing { + useInMemoryPgpKeys( + project.findProperty("signingKey") as String?, + project.findProperty("signingPassword") as String? + ) + sign(publishing.publications["maven"]) } From a64fc9d8f9e2ff85d57d33598611f559126cf376 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:47:09 +0200 Subject: [PATCH 3/5] feat(gradle): add the Maven Central repository to the publishing plugin configuration --- build.gradle.kts | 50 ++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0f0dbf3..f4ca0d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,36 +47,44 @@ tasks { } publishing { - publications { - create("maven") { - from(components["java"]) + publications.create("maven") { + from(components["java"]) - pom { - url = "https://github.com/Hypejet/Modules" + pom { + url = "https://github.com/Hypejet/Modules" - licenses { - license { - name = "The Apache License, Version 2.0" - url = "https://www.apache.org/licenses/LICENSE-2.0.txt" - } + licenses { + license { + name = "The Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" } + } - developers { - developer { - id = "Codestech1" - name = "Codestech" - email = "codestech@hypejet.net" - } + developers { + developer { + id = "Codestech1" + name = "Codestech" + email = "codestech@hypejet.net" } + } - scm { - connection = "scm:git:git://github.com/Hypejet/Modules.git" - developerConnection = "scm:git:ssh://github.com:Hypejet/Modules.git" - url = "https://github.com/Hypejet/Modules" - } + scm { + connection = "scm:git:git://github.com/Hypejet/Modules.git" + developerConnection = "scm:git:ssh://github.com:Hypejet/Modules.git" + url = "https://github.com/Hypejet/Modules" } } } + + repositories.maven { + name = "mavenCentral" + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + + credentials { + username = project.findProperty("mavenCentralUsername") as String? + password = project.findProperty("mavenCentralPassword") as String? + } + } } signing { From 1bce4f48633734048e9d7b66ca0df8e85d6cf63c Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Fri, 10 Jul 2026 21:05:06 +0200 Subject: [PATCH 4/5] feat(actions): a workflow publishing releases to Maven Central --- .github/workflows/publish.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6f07b01 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish to Maven Central + +on: + release: + types: [created] + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Set up JDK 25 + uses: actions/setup-java@v5 + with: + java-version: '25' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + - name: Publish to Maven Central + run: ./gradlew publishMavenPublicationToMavenCentralRepository + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} \ No newline at end of file From 5332ed091776a5fac3e5e82563057d9594e8f825 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Fri, 10 Jul 2026 21:29:51 +0200 Subject: [PATCH 5/5] misc(actions|gradle): temporary changes for testing the workflow version getting --- .github/workflows/publish.yml | 2 +- build.gradle.kts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6f07b01..d5860e8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Publish to Maven Central - run: ./gradlew publishMavenPublicationToMavenCentralRepository + run: ./gradlew printVersion env: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/build.gradle.kts b/build.gradle.kts index f4ca0d5..e5eb351 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { val javaVersion = 25 group = "net.hypejet" -version = "1.0-SNAPSHOT" +version = System.getenv("GITHUB_REF_NAME") ?: "1.0-SNAPSHOT" description = "A Java library making modular programming easier" repositories { @@ -44,6 +44,10 @@ tasks { test { useJUnitPlatform() } + + register("printVersion") { + println(project.version) + } } publishing { @@ -76,7 +80,7 @@ publishing { } } - repositories.maven { + /*repositories.maven { name = "mavenCentral" url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") @@ -84,7 +88,7 @@ publishing { username = project.findProperty("mavenCentralUsername") as String? password = project.findProperty("mavenCentralPassword") as String? } - } + }*/ } signing {