-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
117 lines (96 loc) · 3.09 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import java.net.URI
plugins {
id("org.jetbrains.kotlin.jvm").version("1.9.22")
id("java-gradle-plugin")
id("maven-publish")
id("signing")
}
val pluginDescription = "Plugin that helps you publish to the Central Portal (https://central.sonatype.org/)"
gradlePlugin {
plugins {
create("nmcp") {
id = "com.gradleup.nmcp"
implementationClass = "nmcp.NmcpPlugin"
this.description = pluginDescription
this.displayName = "nmcp"
}
}
}
group = "com.gradleup.nmcp"
version = "0.0.8"
publishing {
repositories {
repositories {
maven {
name = "OssStaging"
url = URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USER")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
publications.configureEach {
this as MavenPublication
if (name == "pluginMaven") {
artifact(tasks.register("emptySources", Jar::class.java) {
archiveClassifier = "sources"
})
artifact(tasks.register("emptyDocs", Jar::class.java) {
archiveClassifier = "javadoc"
})
groupId = project.rootProject.group.toString()
version = project.rootProject.version.toString()
artifactId = project.name
}
pom {
name.set(project.name)
description.set(pluginDescription)
url.set("https://github.com/gradleup/nmcp")
scm {
url.set("https://github.com/gradleup/nmcp")
connection.set("https://github.com/gradleup/nmcp")
developerConnection.set("https://github.com/gradleup/nmcp")
}
licenses {
license {
name.set("MIT License")
url.set("https://github.com/gradleup/nmcp/blob/master/LICENSE")
}
}
developers {
developer {
id.set("GradleUp developers")
name.set("GradleUp developers")
}
}
}
}
}
signing {
sign(publishing.publications)
useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
}
dependencies {
implementation("com.squareup.okio:okio:3.8.0")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
}
fun isTag(): Boolean {
val ref = System.getenv("GITHUB_REF")
return ref?.startsWith("refs/tags/") == true
}
tasks.register("ci")
if (isTag()) {
rootProject.tasks.named("ci") {
dependsOn(tasks.named("publishAllPublicationsToOssStagingRepository"))
}
}
tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}
tasks.withType(Sign::class.java).configureEach {
isEnabled = System.getenv("GPG_KEY").isNullOrBlank().not()
}