Skip to content

Commit

Permalink
build: only signing on release (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun authored Oct 14, 2024
1 parent 0744c60 commit b314e29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions buildSrc/src/main/kotlin/java-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ publishing {
}
}

if (!System.getenv("GITHUB_WORKFLOW").equals("CI", true)) {
signing {
sign(publishing.publications["mavenJava"])
signing {
setRequired {
val releaseVersion = !version.toString().endsWith("-SNAPSHOT")
// signing is required if this is a release version and the artifacts are to be published
// do not use hasTask() as this require realization of the tasks that maybe are not necessary
releaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
sign(publishing.publications["mavenJava"])
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.

group=com.tisonkun.os
version=0.4.0
version=0.5.0
10 changes: 7 additions & 3 deletions plugin-gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ publishing {
}
}

if (!System.getenv("GITHUB_WORKFLOW").equals("CI", true)) {
signing {
sign(publishing.publications)
signing {
setRequired {
val releaseVersion = !version.toString().endsWith("-SNAPSHOT")
// signing is required if this is a release version and the artifacts are to be published
// do not use hasTask() as this require realization of the tasks that maybe are not necessary
releaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
sign(publishing.publications)
}

0 comments on commit b314e29

Please sign in to comment.