Skip to content

Commit 232a6b0

Browse files
authored
Revert "misc: enable signing with JReleaser (#126)" (#133)
This reverts commit 4e259cf.
1 parent ef81b38 commit 232a6b0

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
@@ -183,7 +183,8 @@ fun Project.configureNexusPublishing(repoName: String, githubOrganization: Strin
183183
}
184184

185185
/**
186-
* Configure publishing for this project. This applies the `maven-publish` plugin and configures publications.
186+
* Configure publishing for this project. This applies the `maven-publish` and `signing` plugins and configures
187+
* the publications.
187188
* @param repoName the repository name (e.g. `smithy-kotlin`, `aws-sdk-kotlin`, etc)
188189
* @param githubOrganization the name of the GitHub organization that [repoName] is located in
189190
*/
@@ -236,6 +237,23 @@ fun Project.configurePublishing(repoName: String, githubOrganization: String = "
236237
}
237238
}
238239
}
240+
241+
val secretKey = System.getenv(EnvironmentVariables.GPG_SECRET_KEY)
242+
val passphrase = System.getenv(EnvironmentVariables.GPG_PASSPHRASE)
243+
244+
if (!secretKey.isNullOrBlank() && !passphrase.isNullOrBlank()) {
245+
apply(plugin = "signing")
246+
extensions.configure<SigningExtension> {
247+
useInMemoryPgpKeys(secretKey, passphrase)
248+
sign(publications)
249+
}
250+
251+
// FIXME - workaround for https://github.com/gradle/gradle/issues/26091
252+
val signingTasks = tasks.withType<Sign>()
253+
tasks.withType<AbstractPublishToMaven>().configureEach {
254+
mustRunAfter(signingTasks)
255+
}
256+
}
239257
}
240258

241259
tasks.withType<AbstractPublishToMaven>().configureEach {
@@ -295,9 +313,6 @@ fun Project.configureJReleaser() {
295313
val requiredVariables = listOf(
296314
EnvironmentVariables.MAVEN_CENTRAL_USERNAME,
297315
EnvironmentVariables.MAVEN_CENTRAL_TOKEN,
298-
EnvironmentVariables.GPG_PASSPHRASE,
299-
EnvironmentVariables.GPG_PUBLIC_KEY,
300-
EnvironmentVariables.GPG_SECRET_KEY,
301316
EnvironmentVariables.GENERIC_TOKEN,
302317
)
303318

@@ -332,11 +347,6 @@ fun Project.configureJReleaser() {
332347
version = providers.gradleProperty("sdkVersion").get()
333348
}
334349

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

0 commit comments

Comments
 (0)