From 10f4e8d8dfbce6c65b8e97d27f1ed36a6d7b85fd Mon Sep 17 00:00:00 2001 From: Oguzhan Soykan Date: Wed, 19 Oct 2022 11:10:36 +0200 Subject: [PATCH] add credentials for nexus --- build.gradle.kts | 1 - .../main/kotlin/kediatr-publishing.gradle.kts | 26 ++++++++++--------- .../main/kotlin/kediatr-signing.gradle.kts | 8 ------ 3 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/kediatr-signing.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 66a9dba..12235d7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,6 @@ version = "2.0.0-SNAPSHOT" plugins { kotlin("jvm") version "1.7.20" id("kediatr-publishing") apply false - id("kediatr-signing") id("kediatr-coverage") id("org.jlleitschuh.gradle.ktlint") version "11.0.0" } diff --git a/buildSrc/src/main/kotlin/kediatr-publishing.gradle.kts b/buildSrc/src/main/kotlin/kediatr-publishing.gradle.kts index d470134..ce2dbf7 100644 --- a/buildSrc/src/main/kotlin/kediatr-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/kediatr-publishing.gradle.kts @@ -2,7 +2,16 @@ plugins { `maven-publish` signing } - +fun getProperty( + projectKey: String, + environmentKey: String, +): String? { + return if (project.hasProperty(projectKey)) { + project.property(projectKey) as? String? + } else { + System.getenv(environmentKey) + } +} afterEvaluate { publishing { publications { @@ -50,21 +59,14 @@ afterEvaluate { val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl // url = uri(layout.buildDirectory.dir("mavenlocalpublish")) + credentials { + username = getProperty("nexus_username", "nexus_username") + password = getProperty("nexus_password", "nexus_password") + } } } } - fun getProperty( - projectKey: String, - environmentKey: String, - ): String? { - return if (project.hasProperty(projectKey)) { - project.property(projectKey) as? String? - } else { - System.getenv(environmentKey) - } - } - val signingKey = getProperty(projectKey = "gpg.key", environmentKey = "gpg_private_key") val passPhrase = getProperty(projectKey = "gpg.passphrase", environmentKey = "gpg_passphrase") signing { diff --git a/buildSrc/src/main/kotlin/kediatr-signing.gradle.kts b/buildSrc/src/main/kotlin/kediatr-signing.gradle.kts deleted file mode 100644 index 54a362b..0000000 --- a/buildSrc/src/main/kotlin/kediatr-signing.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -plugins { - id("maven-publish") - signing -} - -signing { - sign(publishing.publications) -}