-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
53 lines (47 loc) · 1.87 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.serialization) apply false
}
allprojects {
repositories {
mavenCentral()
google()
}
}
fun gradlePropertyOrEnvironmentVariable(name: String) = (project.findProperty(name) ?: System.getenv(name)) as? String
val signingKeyAsciiArmored = gradlePropertyOrEnvironmentVariable("SIGNING_KEY")
val signingKeyPassword = gradlePropertyOrEnvironmentVariable("SIGNING_PASSWORD")
if (signingKeyAsciiArmored != null) {
subprojects {
plugins.withType<SigningPlugin> {
configure<SigningExtension> {
useInMemoryPgpKeys(signingKeyAsciiArmored, signingKeyPassword)
sign(extensions.getByType<PublishingExtension>().publications)
}
}
}
}
val sonatypeUsername = gradlePropertyOrEnvironmentVariable("SONATYPE_USERNAME")
val sonatypePassword = gradlePropertyOrEnvironmentVariable("SONATYPE_PASSWORD")
if (sonatypeUsername != null) {
subprojects {
plugins.withType<MavenPublishPlugin> {
configure<PublishingExtension> {
repositories {
maven {
name = "oss"
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("-SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
}
}
}