forked from howardpang/androidNativeBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish_lib.gradle
35 lines (30 loc) · 1.05 KB
/
publish_lib.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
publishing {
repositories {
maven {
credentials {
username = properties.getProperty('ossrhUsername')
password = properties.getProperty('ossrhPassword')
}
if (isReleaseBuild()) {
url getReleaseRepositoryUrl()
} else {
url getSnapshotRepositoryUrl()
}
}
}
}