From c00d9c12692bc9761205bb8416d4f74d20ede996 Mon Sep 17 00:00:00 2001 From: Serhii Date: Tue, 9 Jan 2024 18:11:14 +0900 Subject: [PATCH] Artifact publish requirements (#44) * add singing module * update publishing gradle tasks --- README.md | 14 ++++++++++++-- build.gradle.kts | 18 ++++++++++++++++++ gradle.properties | 6 ++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gradle.properties diff --git a/README.md b/README.md index 8947d84..f195540 100644 --- a/README.md +++ b/README.md @@ -37,15 +37,25 @@ To build or test RedPulsar, run the following command: ```bash git clone git@github.com:himadieievsv/redpulsar.git cd redpulsar + # Code formatting ./gradlew ktlintFormat + # Run all tests docker-compose up -d ./gradlew test + # Run only unit tests ./gradlew test -DexcludeTags="integration" -# Build and publish to local maven repository -./gradlew build -x test publishToMavenLocal + +# Build +./gradlew build -x test + +# Publish to local maven repository +./gradlew publishToMavenLocal \ + -Psigning.secretKeyRingFile=... \ + -Psigning.password=... \ + -Psigning.keyId=... ``` ## Further development diff --git a/build.gradle.kts b/build.gradle.kts index 7a70354..03496db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import java.net.URI + buildscript { repositories { mavenCentral() @@ -10,6 +12,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "12.0.3" id("org.jetbrains.kotlinx.kover") version "0.7.5" `maven-publish` + signing idea } @@ -28,6 +31,7 @@ subprojects { apply(plugin = "idea") apply(plugin = "java-library") apply(plugin = "maven-publish") + apply(plugin = "signing") apply(plugin = "org.jetbrains.kotlinx.kover") kotlin { @@ -72,6 +76,16 @@ subprojects { } publishing { + repositories { + maven { + url = URI.create("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = providers.gradleProperty("ossrhUsername").get() + password = providers.gradleProperty("ossrhPassword").get() + } + } + } + publications { create("mavenJava") { groupId = group.toString() @@ -105,6 +119,10 @@ subprojects { } } + signing { + sign(publishing.publications["mavenJava"]) + } + tasks.test { useJUnitPlatform { excludeTags(*System.getProperty("excludeTags", "no-tag").split(",").toTypedArray()) diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..d681957 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +signing.keyId=YourKeyId +signing.password=YourPublicKeyPassword +signing.secretKeyRingFile=PathToYourKeyRingFile + +ossrhUsername=your-jira-id +ossrhPassword=your-jira-password