forked from divkit/divkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-common.gradle
113 lines (97 loc) · 3.58 KB
/
publish-common.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
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
import com.yandex.div.gradle.PublicationType
apply plugin: 'maven-publish'
apply plugin: 'signing'
buildscript {
}
group = 'com.yandex.div'
ext {
publicationType = PublicationType.fromString(rootProject.findProperty("publicationType"))
mavenCentralUsername = rootProject.findProperty("mavenCentralUsername")
mavenCentralPassword = rootProject.findProperty("mavenCentralPassword")
artifactoryUsername = rootProject.findProperty("artifactoryUsername")
artifactoryPassword = rootProject.findProperty("artifactoryPassword")
signingKeyId = rootProject.findProperty("signingKeyId")
signingPassword = rootProject.findProperty("signingPassword")
signingSecretKeyRingFile = rootProject.findProperty("signingSecretKeyRingFile")
commitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'arc', 'rev-parse', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
}
def publishToArtifactory = artifactoryUsername != null && artifactoryPassword != null
def publishToMavenCentral = mavenCentralUsername != null && mavenCentralPassword != null
if (publishToMavenCentral) {
rootProject.ext {
signing {
keyId = signingKeyId
password = signingPassword
secretKeyRingFile = signingSecretKeyRingFile
}
ossrhUsername = mavenCentralUsername
ossrhPassword = mavenCentralPassword
}
}
afterEvaluate {
if (publishToMavenCentral) {
signing {
sign publishing.publications
sign configurations.archives
}
}
publishing {
publications {
release(MavenPublication) {
pom {
name = "DivKit"
description = "DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app."
url = "http://divkit.tech/"
licenses {
license {
name = "Apache License, version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
scm {
connection = "scm:git://github.com/divkit/divkit.git"
developerConnection = "scm:git://github.com/divkit/divkit.git"
url = "https://github.com/divkit/divkit.git"
}
developers {
developer {
name = "Yandex"
url = "http://divkit.tech/"
}
}
}
ext.repo = 'release'
}
}
repositories {
if (publishToArtifactory) {
maven {
name 'artifactory'
credentials {
username artifactoryUsername
password artifactoryPassword
}
url = publicationType.artifactoryUrl
}
}
if (publishToMavenCentral) {
maven {
name 'mavenCentral'
credentials {
username mavenCentralUsername
password mavenCentralPassword
}
url = publicationType.mavenCentralUrl
}
}
}
}
}