From 7793fff2b9f58750498431267d6ece720889a6d8 Mon Sep 17 00:00:00 2001 From: Marvin Schramm Date: Tue, 16 Feb 2021 08:07:59 +0100 Subject: [PATCH] move signing into sub project --- .github/workflows/hndrs-gradle-publish.yml | 2 ++ build.gradle.kts | 9 --------- spring-json-api-starter/build.gradle.kts | 10 +++++++++- spring-json-api/build.gradle.kts | 11 ++++++++++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/hndrs-gradle-publish.yml b/.github/workflows/hndrs-gradle-publish.yml index 83437a6..cc1260f 100644 --- a/.github/workflows/hndrs-gradle-publish.yml +++ b/.github/workflows/hndrs-gradle-publish.yml @@ -5,6 +5,8 @@ on: push: tags: - v* + branches: + - main # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/build.gradle.kts b/build.gradle.kts index 2c20dbc..3459dbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -131,15 +131,6 @@ subprojects { } } } - - val signingKey: String? = System.getenv("SIGNING_KEY") - val signingPassword: String? = System.getenv("SIGNING_PASSWORD") - if (signingKey != null && signingPassword != null) { - signing { - useInMemoryPgpKeys(groovy.json.StringEscapeUtils.unescapeJava(signingKey), signingPassword) - sign(publications[project.name]) - } - } } } diff --git a/spring-json-api-starter/build.gradle.kts b/spring-json-api-starter/build.gradle.kts index bf40224..6780ccd 100644 --- a/spring-json-api-starter/build.gradle.kts +++ b/spring-json-api-starter/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { publishingInfo { description = "SpringBoot json api response starter" } -publishing{ +publishing { val sourcesJarSubProject by tasks.creating(Jar::class) { dependsOn("classes") archiveClassifier.set("sources") @@ -28,5 +28,13 @@ publishing{ } } + val signingKey: String? = System.getenv("SIGNING_KEY") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + if (signingKey != null && signingPassword != null) { + signing { + useInMemoryPgpKeys(groovy.json.StringEscapeUtils.unescapeJava(signingKey), signingPassword) + sign(publications[project.name]) + } + } } } diff --git a/spring-json-api/build.gradle.kts b/spring-json-api/build.gradle.kts index 041e635..3165763 100644 --- a/spring-json-api/build.gradle.kts +++ b/spring-json-api/build.gradle.kts @@ -13,8 +13,9 @@ publishing{ archiveClassifier.set("sources") from(sourceSets["main"].allSource) } - + publications { + println("Pub ${project.name}") create(project.name) { from(components["java"]) artifact(sourcesJarSubProject) @@ -26,5 +27,13 @@ publishing{ } } + val signingKey: String? = System.getenv("SIGNING_KEY") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + if (signingKey != null && signingPassword != null) { + signing { + useInMemoryPgpKeys(groovy.json.StringEscapeUtils.unescapeJava(signingKey), signingPassword) + sign(publications[project.name]) + } + } } }