Skip to content

Commit fcadc64

Browse files
committed
Revert "misc: enable signing with JReleaser (#126)"
This reverts commit 4e259cf.
1 parent e1864e3 commit fcadc64

File tree

2 files changed

+20
-42
lines changed
  • .github/actions/jreleaser
  • build-plugins/build-support/src/main/kotlin/aws/sdk/kotlin/gradle/dsl

2 files changed

+20
-42
lines changed

.github/actions/jreleaser/action.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,5 @@ runs:
1818
export JRELEASER_MAVENCENTRAL_USERNAME="foo"
1919
export JRELEASER_MAVENCENTRAL_TOKEN="foo"
2020
export JRELEASER_GENERIC_TOKEN="foo"
21-
22-
export JRELEASER_GPG_PASSPHRASE="foo"
23-
export JRELEASER_GPG_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK-----
2421
25-
mDMEaL8nuRYJKwYBBAHaRw8BAQdAWL775FzgrwDmg7muKyddMoed4k/Xb/fYly/J
26-
/uDD2wy0BHRlc3SIkwQTFgoAOxYhBLcG5xXLamZFShYwTwukzlxOPrMDBQJovye5
27-
AhsDBQsJCAcCAiICBhUKCQgLAgQWAgMBAh4HAheAAAoJEAukzlxOPrMDAHsBAPC+
28-
eUMDlJlvQDLduN0+BGD75RENyayZONHT42H2+U+aAP9wwQBJfhCCEzY3GpeavFgz
29-
4IyWZf5Wh4m2/qKPpW10B7g4BGi/J7kSCisGAQQBl1UBBQEBB0AETG4BD1cgDqs1
30-
lfU9+R/ECvlY4AdiO8iqBUtuabtMZwMBCAeIeAQYFgoAIBYhBLcG5xXLamZFShYw
31-
TwukzlxOPrMDBQJovye5AhsMAAoJEAukzlxOPrMDuzkA/2WXh8Wikfpx6O4xoZf0
32-
2Faek9vBPZlTM7Caoeq4tSV4AQCYcg1P9BFghqhnwvrRZvdQQTx76umHLz8enbke
33-
OAHfDw==
34-
=/9s0
35-
-----END PGP PUBLIC KEY BLOCK-----
36-
"
37-
export JRELEASER_GPG_SECRET_KEY="-----BEGIN PGP PRIVATE KEY BLOCK-----
38-
39-
lIYEaL8nuRYJKwYBBAHaRw8BAQdAWL775FzgrwDmg7muKyddMoed4k/Xb/fYly/J
40-
/uDD2wz+BwMCt8L5E1VPKf77t6bLQLCI+2wjvZ44neIE4Y1VKcXo0Al8Dr3kiQ/g
41-
1QU5HyRVGFjP1D4G4t3uRItcXVTkTIjS8CPEbDX9gjmKI11ofAy6U7QEdGVzdIiT
42-
BBMWCgA7FiEEtwbnFctqZkVKFjBPC6TOXE4+swMFAmi/J7kCGwMFCwkIBwICIgIG
43-
FQoJCAsCBBYCAwECHgcCF4AACgkQC6TOXE4+swMAewEA8L55QwOUmW9AMt243T4E
44-
YPvlEQ3JrJk40dPjYfb5T5oA/3DBAEl+EIITNjcal5q8WDPgjJZl/laHibb+oo+l
45-
bXQHnIsEaL8nuRIKKwYBBAGXVQEFAQEHQARMbgEPVyAOqzWV9T35H8QK+VjgB2I7
46-
yKoFS25pu0xnAwEIB/4HAwJjZQiU4xs+4/szvtJM8d6hcARU5Q4Q5SZUB2AL2RCm
47-
DdH6rGZUEQCu4GTkp0vdvLHv0xiBOPBbbvMbmB3o4ZY+PjhHWnPjRMq4+x9owetd
48-
iHgEGBYKACAWIQS3BucVy2pmRUoWME8LpM5cTj6zAwUCaL8nuQIbDAAKCRALpM5c
49-
Tj6zA7s5AP9ll4fFopH6cejuMaGX9NhWnpPbwT2ZUzOwmqHquLUleAEAmHINT/QR
50-
YIaoZ8L60Wb3UEE8e+rphy8/Hp25HjgB3w8=
51-
=9G5n
52-
-----END PGP PRIVATE KEY BLOCK-----
53-
"
54-
5522
./gradlew jreleaserFullRelease --dryrun --stacktrace

build-plugins/build-support/src/main/kotlin/aws/sdk/kotlin/gradle/dsl/Publish.kt

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ fun Project.configureNexusPublishing(repoName: String, githubOrganization: Strin
182182
}
183183

184184
/**
185-
* Configure publishing for this project. This applies the `maven-publish` plugin and configures publications.
185+
* Configure publishing for this project. This applies the `maven-publish` and `signing` plugins and configures
186+
* the publications.
186187
* @param repoName the repository name (e.g. `smithy-kotlin`, `aws-sdk-kotlin`, etc)
187188
* @param githubOrganization the name of the GitHub organization that [repoName] is located in
188189
*/
@@ -235,6 +236,23 @@ fun Project.configurePublishing(repoName: String, githubOrganization: String = "
235236
}
236237
}
237238
}
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+
sign(publications)
248+
}
249+
250+
// FIXME - workaround for https://github.com/gradle/gradle/issues/26091
251+
val signingTasks = tasks.withType<Sign>()
252+
tasks.withType<AbstractPublishToMaven>().configureEach {
253+
mustRunAfter(signingTasks)
254+
}
255+
}
238256
}
239257

240258
tasks.withType<AbstractPublishToMaven>().configureEach {
@@ -294,9 +312,6 @@ fun Project.configureJReleaser() {
294312
val requiredVariables = listOf(
295313
EnvironmentVariables.MAVEN_CENTRAL_USERNAME,
296314
EnvironmentVariables.MAVEN_CENTRAL_TOKEN,
297-
EnvironmentVariables.GPG_PASSPHRASE,
298-
EnvironmentVariables.GPG_PUBLIC_KEY,
299-
EnvironmentVariables.GPG_SECRET_KEY,
300315
EnvironmentVariables.GENERIC_TOKEN,
301316
)
302317

@@ -331,11 +346,6 @@ fun Project.configureJReleaser() {
331346
version = providers.gradleProperty("sdkVersion").get()
332347
}
333348

334-
signing {
335-
active = Active.ALWAYS
336-
armored = true
337-
}
338-
339349
// JReleaser requires a releaser to be configured even though we don't use it.
340350
// https://github.com/jreleaser/jreleaser/discussions/1725#discussioncomment-10674529
341351
release {
@@ -355,6 +365,7 @@ fun Project.configureJReleaser() {
355365
mavenCentral {
356366
create("maven-central") {
357367
active = Active.ALWAYS // the Maven deployer default is ALWAYS, but MavenCentral is NEVER
368+
sign = false // Signing is done when publishing, see the 'configurePublishing' function
358369
url = "https://central.sonatype.com/api/v1/publisher"
359370
stagingRepository(rootProject.layout.buildDirectory.dir("m2").get().toString())
360371
artifacts {

0 commit comments

Comments
 (0)