-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.gradle
116 lines (108 loc) · 4.37 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
113
114
115
116
project.description = "publish.gradle"
project.group = "me.moallemi.tools"
project.version = "0.0.1"
project.ext {
artifactId = 'kotlin-date-extensions'
name = 'Kotlin Date Extensions'
url = "https://github.com/moallemi/kotlin-date-extensions"
scm = [
connectionUrl : "scm:git@github.com:moallemi/kotlin-date-extensions.git",
developerConnectionUrl: "scm:git@github.com:moallemi/kotlin-date-extensions.git"
]
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier.set("sources")
}
task javadocJar(type: Jar) {
from tasks.javadoc
archiveClassifier.set("javadoc")
}
publishing {
publications {
kotlinDateExtensions(MavenPublication) {
groupId = project.group
artifactId = project.artifactId
version = project.version
from components.java
artifact tasks["sourcesJar"]
artifact tasks["javadocJar"]
pom {
name = project.name
packaging "jar"
description = project.description
url = project.url
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'moallemi'
name = 'Reza Moallemi'
}
}
scm {
url = project.url
connection = project.scm.connectionUrl
developerConnection = project.scm.developerConnectionUrl
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv('SONATYPE_USERNAME')
password System.getenv('SONATYPE_PASSWORD')
}
}
}
}
signing {
required !version.endsWith('SNAPSHOT')
useInMemoryPgpKeys(System.getenv('SIGNING_KEY'), System.getenv('SIGNING_PASSWORD'))
sign(publishing.publications["kotlinDateExtensions"])
}
bintray {
user = System.getenv('BINTRAY_USERNAME')
key = System.getenv('BINTRAY_API_KEY')
publications = ['kotlinDateExtensions']
dryRun = false
pkg {
repo = 'maven'
name = 'kotlin-date-range'
desc = project.description
websiteUrl = project.url
issueTrackerUrl = 'https://github.com/moallemi/kotlin-date-extesions/issues'
vcsUrl = 'https://github.com/moallemi/kotlin-date-extensions.git'
licenses = ['Apache-2.0']
labels = ['kotlin', 'android', 'date', 'local-date', 'date-range']
publicDownloadNumbers = false
githubRepo = 'moallemi/kotlin-date-extensions' //Optional Github repository
githubReleaseNotesFile = 'README.md' //Optional Github readme file
version {
name = project.version
//desc = 'optional, version-specific description'
//released = 'optional, date of the version release' //2 possible values: date in the format of 'yyyy-MM-dd'T'HH:mm:ss.SSSZZ' OR a java.util.Date instance
//vcsTag = '1.3.0'
// attributes = [] //Optional version-level attributes
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = System.getenv('BINTRAY_SIGNING_PASSWORD') //Optional. The passphrase for GPG signing'
}
mavenCentralSync {
sync = false //Optional (true by default). Determines whether to sync the version to Maven Central.
user = System.getenv('SONATYPE_USERNAME') //OSS user token
password = System.getenv('SONATYPE_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.
}
}
}
}