-
Notifications
You must be signed in to change notification settings - Fork 202
/
build.gradle
81 lines (72 loc) · 2.86 KB
/
build.gradle
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
plugins {
id "org.gradle.base"
id "org.shipkit.shipkit-changelog" version "1.2.0"
id "org.shipkit.shipkit-github-release" version "1.2.0"
id "org.shipkit.shipkit-auto-version" version "1.2.2"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
id "org.jetbrains.kotlin.jvm" version "1.9.20" apply false
id "org.jetbrains.dokka" version "1.9.10" apply false
}
def test = tasks.register("test") {
dependsOn gradle.includedBuild("tests").task(":test")
}
tasks.named("check") {
dependsOn test
}
tasks.named("generateChangelog") {
previousRevision = project.ext.'shipkit-auto-version.previous-version'
githubToken = System.getenv("GITHUB_TOKEN")
repository = "mockito/mockito-kotlin"
releaseTag = project.version
}
tasks.named("githubRelease") {
def genTask = tasks.named("generateChangelog").get()
dependsOn genTask
repository = genTask.repository
changelog = genTask.outputFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
releaseTag = project.version
releaseName = project.version
}
// Will be used to handle Sonatype staging repositories.
group = 'org.mockito.kotlin'
nexusPublishing {
repositories {
if (System.getenv("NEXUS_TOKEN_PWD")) {
sonatype {
// Publishing to: https://s01.oss.sonatype.org (faster instance)
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = System.getenv("NEXUS_TOKEN_USER")
password = System.getenv("NEXUS_TOKEN_PWD")
}
}
}
}
def isSnapshot = version.endsWith("-SNAPSHOT")
if (isSnapshot) {
println "Building a -SNAPSHOT version (Github release and Maven Central tasks are skipped)"
tasks.named("githubRelease") {
//snapshot versions do not produce changelog / Github releases
enabled = false
}
tasks.named("closeAndReleaseStagingRepository") {
//snapshot binaries are available in Sonatype without the need to close the staging repo
enabled = false
}
}
tasks.register("releaseSummary") {
doLast {
if (isSnapshot) {
println "RELEASE SUMMARY\n" +
" SNAPSHOTS released to: https://s01.oss.sonatype.org/content/repositories/snapshots/org/mockito/kotlin/mockito-kotlin\n" +
" Release to Maven Central: SKIPPED FOR SNAPSHOTS\n" +
" Github releases: SKIPPED FOR SNAPSHOTS"
} else {
println "RELEASE SUMMARY\n" +
" Release to Maven Central (available after delay): https://repo1.maven.org/maven2/org/mockito/kotlin/mockito-kotlin/\n" +
" Github releases: https://github.com/mockito/mockito-kotlin/releases"
}
}
}