Skip to content

Commit

Permalink
fix(build): Sign all artifacts on release (#541)
Browse files Browse the repository at this point in the history
This commit tries to fix the problem where some artifacts are not signed on release.
  • Loading branch information
matrei authored Mar 9, 2024
1 parent ddfa6fb commit dede651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ gradlePlugin {

afterEvaluate {
signing {
def publicationContainer = project.extensions.findByType(PublishingExtension).publications
required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') }
Publication[] publications = new Publication[publishing.publications.size() - 1]
publishing.publications.findAll { it.name != 'pluginMaven' }.toArray(publications)
sign(publications)
Publication[] publicationsToSign = new Publication[publicationContainer.size() - 1]
publicationContainer.findAll { it.name != 'pluginMaven' }.toArray(publicationsToSign)
sign(publicationsToSign)
}

publishing.publications.each { publication ->
Expand Down
8 changes: 5 additions & 3 deletions gradle/grailsCentralPublishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe ->
}

afterEvaluate {
def mavenPublication = project.extensions.findByType(PublishingExtension).publications.named('pluginMaven')
project.extensions.configure(SigningExtension) { SigningExtension se ->
def publicationContainer = extensions.findByType(PublishingExtension).publications
extensions.configure(SigningExtension) { SigningExtension se ->
se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') }
se.sign mavenPublication.get()
Publication[] publicationsToSign = new Publication[publicationContainer.size()]
publicationContainer.findAll().toArray(publicationsToSign)
se.sign(publicationsToSign)
}
}

Expand Down

0 comments on commit dede651

Please sign in to comment.