-
Notifications
You must be signed in to change notification settings - Fork 49
/
publish.gradle
112 lines (104 loc) · 4.2 KB
/
publish.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
apply plugin: 'maven-publish'
group = 'com.vimeo.networking'
// Create the pom configuration
// All the fields below are required by Maven Central
def pomConfig = {
licenses {
license {
name "MIT License"
url "http://www.opensource.org/licenses/mit-license.php"
distribution "repo"
}
}
developers {
developer {
id "vimeo"
name "Vimeo Mobile"
email "[email protected]"
organisation "Vimeo"
organisationUrl "https://github.com/vimeo"
}
}
scm {
connection "scm:git:git://github.com/vimeo/vimeo-networking-java.git"
developerConnection "scm:git:ssh://github.com:vimeo/vimeo-networking-java.git"
url "https://github.com/vimeo/vimeo-networking-java"
}
}
allprojects {
afterEvaluate {
// Create the publication with the pom configuration:
// Requires apply plugin: maven-publish
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description', 'vimeo-networking is a networking library used for interacting with the Vimeo API. It is Java and Kotlin friendly.')
root.appendNode('name', 'vimeo-networking')
root.appendNode('url', 'https://github.com/vimeo/vimeo-networking-java')
root.children().last() + pomConfig
}
}
}
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
// Only execute the bintray task if this is the actual networking project (not an include)
allprojects {
afterEvaluate { project ->
def bintrayProject = project.plugins.hasPlugin('com.jfrog.bintray')
if (bintrayProject) {
bintray {
user = System.getenv('BINTRAY_USER')
// api key
key = System.getenv('BINTRAY_API_KEY')
publications = ['MyPublication']
dryRun = false // Whether to run this as dry-run, without deploying
override = false
pkg {
repo = 'maven'
name = 'vimeo-networking'
userOrg = 'vimeo'
licenses = ['MIT']
websiteUrl = 'https://github.com/vimeo/vimeo-networking-java'
issueTrackerUrl = 'https://github.com/vimeo/vimeo-networking-java/issues'
vcsUrl = 'https://github.com/vimeo/vimeo-networking-java.git'
labels = ['vimeo', 'android', 'java', 'networking', 'api']
publicDownloadNumbers = true
version {
name = project.version
vcsTag = project.version
gpg {
sign = true
passphrase = System.getenv('BINTRAY_GPG_PASSWORD')
}
mavenCentralSync {
sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
user = System.getenv('SONATYPE_TOKEN_USER') //OSS user token
password = System.getenv('SONATYPE_TOKEN_PASSWORD') //OSS user password
close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
}
}
}
}
}
}
}