@@ -182,8 +182,7 @@ fun Project.configureNexusPublishing(repoName: String, githubOrganization: Strin
182182}
183183
184184/* *
185- * Configure publishing for this project. This applies the `maven-publish` and `signing` plugins and configures
186- * the publications.
185+ * Configure publishing for this project. This applies the `maven-publish` plugin and configures publications.
187186 * @param repoName the repository name (e.g. `smithy-kotlin`, `aws-sdk-kotlin`, etc)
188187 * @param githubOrganization the name of the GitHub organization that [repoName] is located in
189188 */
@@ -236,43 +235,6 @@ fun Project.configurePublishing(repoName: String, githubOrganization: String = "
236235 }
237236 }
238237 }
239-
240- val secretKey = System .getenv(EnvironmentVariables .GPG_SECRET_KEY )
241- val passphrase = System .getenv(EnvironmentVariables .GPG_PASSPHRASE )
242-
243- if (! secretKey.isNullOrBlank() && ! passphrase.isNullOrBlank()) {
244- apply (plugin = " signing" )
245- extensions.configure<SigningExtension > {
246- useInMemoryPgpKeys(secretKey, passphrase)
247- }
248-
249- // Register a task that allows you to sign publications which have already been staged in build/m2
250- project.tasks.register<Sign >(" signAllPublications" ) {
251- val publicationsDir = layout.buildDirectory.dir(" m2" ).get().asFile
252- val toSignTree = fileTree(publicationsDir) {
253- include(" **/*.pom" , " **/*.module" )
254- include(" **/*.jar" )
255- include(" **/*.klib" )
256- include(" **/*.aar" )
257- include(" **/*.zip" , " **/*.tar" , " **/*.tar.gz" )
258- }
259-
260- inputs.files(toSignTree)
261- outputs.upToDateWhen { false } // always re-run task
262-
263- doFirst {
264- logger.lifecycle(" Recomputing signatures for ${toSignTree.files.size} artifacts in $publicationsDir " )
265- }
266-
267- sign(* toSignTree.files.toTypedArray())
268- }
269-
270- // FIXME - workaround for https://github.com/gradle/gradle/issues/26091
271- val signingTasks = tasks.withType<Sign >()
272- tasks.withType<AbstractPublishToMaven >().configureEach {
273- mustRunAfter(signingTasks)
274- }
275- }
276238 }
277239
278240 tasks.withType<AbstractPublishToMaven >().configureEach {
@@ -332,6 +294,9 @@ fun Project.configureJReleaser() {
332294 val requiredVariables = listOf (
333295 EnvironmentVariables .MAVEN_CENTRAL_USERNAME ,
334296 EnvironmentVariables .MAVEN_CENTRAL_TOKEN ,
297+ EnvironmentVariables .GPG_PASSPHRASE ,
298+ EnvironmentVariables .GPG_PUBLIC_KEY ,
299+ EnvironmentVariables .GPG_SECRET_KEY ,
335300 EnvironmentVariables .GENERIC_TOKEN ,
336301 )
337302
@@ -366,6 +331,11 @@ fun Project.configureJReleaser() {
366331 version = providers.gradleProperty(" sdkVersion" ).get()
367332 }
368333
334+ signing {
335+ active = Active .ALWAYS
336+ armored = true
337+ }
338+
369339 // JReleaser requires a releaser to be configured even though we don't use it.
370340 // https://github.com/jreleaser/jreleaser/discussions/1725#discussioncomment-10674529
371341 release {
@@ -385,7 +355,6 @@ fun Project.configureJReleaser() {
385355 mavenCentral {
386356 create(" maven-central" ) {
387357 active = Active .ALWAYS // the Maven deployer default is ALWAYS, but MavenCentral is NEVER
388- sign = false // Signing is done when publishing, see the 'configurePublishing' function
389358 url = " https://central.sonatype.com/api/v1/publisher"
390359 stagingRepository(rootProject.layout.buildDirectory.dir(" m2" ).get().toString())
391360 artifacts {
0 commit comments