Skip to content

Commit

Permalink
try old style of key setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewparmet committed Jun 3, 2022
1 parent e55e8d9 commit a7c67f2
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions buildSrc/src/main/kotlin/ConfigurePublishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.SigningExtension

object ProjectInfo {
const val name = "Buf Gradle Plugin"
Expand All @@ -31,18 +36,28 @@ fun Project.configurePublishing() {
apply(plugin = "com.vanniktech.maven.publish.base")

if (isRelease()) {
setProperty("signingInMemoryKey", System.getenv("PGP_KEY")?.replace('$', '\n'))
setProperty("signingInMemoryPassword", System.getenv("PGP_PASSWORD"))
setProperty("mavenCentralUsername", System.getenv("OSSRH_USERNAME"))
setProperty("mavenCentralPassword", System.getenv("OSSRH_PASSWORD"))

apply(plugin = "signing")

configure<SigningExtension> {
useInMemoryPgpKeys(
System.getenv("PGP_KEY")?.replace('$', '\n'),
System.getenv("PGP_PASSWORD")
)

the<PublishingExtension>().publications.withType<MavenPublication> {
sign(this)
}
}
}

println("signing key length: " + properties["signingInMemoryKey"]?.toString()?.length)

configure<MavenPublishBaseExtension> {
configure(KotlinJvm(JavadocJar.Empty()))
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
pom {
name.set(ProjectInfo.name)
description.set(ProjectInfo.description)
Expand Down

0 comments on commit a7c67f2

Please sign in to comment.