-
Notifications
You must be signed in to change notification settings - Fork 21
/
release.gradle
83 lines (71 loc) · 2.42 KB
/
release.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
82
83
//Plugin jars are added to the buildscript classpath in the root build.gradle file
//////////////////////////////////
// Token Verification Tasks
//////////////////////////////////
task checkGitHubToken {
doFirst {
if (System.getenv("GITHUB_TOKEN") == null) {
throw new Exception("Environment variable GITHUB_TOKEN not set.");
}
println "Using repository " + System.getenv("GITHUB_REPOSITORY")
}
}
task verifyArtifactoryProperties {
doFirst {
if (!project.hasProperty('artifactory.dryRun')) {
if (System.getenv('ARTIFACTORY_USER') == null) {
throw new Exception("Environment variable ARTIFACTORY_USER not set.");
}
if (System.getenv('ARTIFACTORY_KEY') == null) {
throw new Exception("Environment variable ARTIFACTORY_KEY not set.");
}
}
}
}
//////////////////////////////////
// Shipkit Tasks
//////////////////////////////////
apply plugin: "org.shipkit.shipkit-auto-version" //https://github.com/shipkit/shipkit-auto-version
apply plugin: "org.shipkit.shipkit-changelog" //https://github.com/shipkit/shipkit-changelog
tasks.named("generateChangelog") {
dependsOn checkGitHubToken
previousRevision = project.ext.'shipkit-auto-version.previous-tag'
githubToken = System.getenv("GITHUB_TOKEN")
repository = "linkedin/LiFT"
}
apply plugin: "org.shipkit.shipkit-github-release" //https://github.com/shipkit/shipkit-changelog
tasks.named("githubRelease") {
def genTask = tasks.named("generateChangelog").get()
dependsOn genTask
dependsOn checkGitHubToken
repository = genTask.repository
changelog = genTask.outputFile
githubToken = System.getenv("GITHUB_TOKEN")
newTagRevision = System.getenv("GITHUB_SHA")
}
//////////////////////////////////
// Maven Central Config
//////////////////////////////////
apply plugin: "io.github.gradle-nexus.publish-plugin" //https://github.com/gradle-nexus/publish-plugin/
nexusPublishing {
repositories {
if (System.getenv("SONATYPE_PWD")) {
sonatype {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PWD")
}
}
}
}
//////////////////////////////////
// Additional Release Tasks
//////////////////////////////////
task artifactoryPublishAll {
description = "Runs 'artifactoryPublish' tasks from all projects"
}
allprojects {
tasks.matching { it.name == "artifactoryPublish" }.all {
it.dependsOn verifyArtifactoryProperties
artifactoryPublishAll.dependsOn it
}
}