-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathgradle-maven-push.gradle
71 lines (61 loc) · 2.3 KB
/
gradle-maven-push.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
android {
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
afterEvaluate { project ->
publishing {
publications {
maven(MavenPublication) {
groupId rootProject.ext.group
artifactId project.artifactId
version project.version
from components.release
pom {
name = project.artifactId
description = "Backpack is a collection of design resources, reusable components and guidelines for creating Skyscanner's products."
url = 'https://github.com/Skyscanner/backpack-android'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://github.com/Skyscanner/backpack-android/blob/main/LICENSE.txt'
}
}
developers {
developer {
id = 'skyscanner'
name = 'Skyscanner Open Source'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/Skyscanner/backpack-android.git'
developerConnection = 'scm:git:ssh://github.com/Skyscanner/backpack-android.git'
url = 'http://github.com/Skyscanner/backpack-android/tree/main'
}
}
}
}
}
}
tasks.register('checkMavenCredentials') {
doLast {
def props = ["ossrhUsername", "ossrhPassword", "signing.keyId", "signing.password", "signing.secretKeyRingFile", "sonatypeStagingProfileId"]
if (props.any { rootProject.ext[it]?.isEmpty() }) {
ant.fail("Missing maven credentials")
}
}
}
ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
signing {
sign publishing.publications
}
tasks.withType(Sign) {
onlyIf { !project.version.endsWith("SNAPSHOT") }
}