-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublishShadow.gradle
72 lines (67 loc) · 2.52 KB
/
publishShadow.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
ext.snapshotUrl = "http://artifactory.krypt.int/artifactory/libs-snapshot-local"
ext.releaseUrl = "http://artifactory.krypt.int/artifactory/libs-release-local"
ext.sonatypeMasterUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
ext.sonatypeSnapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots"
def branch = System.getenv("bamboo_repository_branch_name")
if( branch == null || branch == "" ) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = stdout
}
branch=stdout.toString().trim();
}
if ( ( System.getenv("bamboo_ARTIFACTORY_USERNAME") != null) && ( System.getenv("bamboo_ARTIFACTORY_PASSWORD")!=null ) ) {
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: 'com.github.johnrengelman.shadow'
if ( branch.equals("develop") || branch.contains("release/") ) {
publishing {
repositories {
maven {
url sonatypeSnapshotUrl
credentials {
username = "$System.env.bamboo_SONATYPE_USERNAME"
password = "$System.env.bamboo_SONATYPE_PASSWORD"
}
}
maven {
url snapshotUrl
credentials {
username = "$System.env.bamboo_ARTIFACTORY_USERNAME"
password = "$System.env.bamboo_ARTIFACTORY_PASSWORD"
}
}
}
publications {
shadow(MavenPublication) {
from components.shadow
}
}
}
} else if ( branch.equals("master") ) {
publishing {
repositories {
maven {
url sonatypeMasterUrl
credentials {
username = "$System.env.bamboo_SONATYPE_USERNAME"
password = "$System.env.bamboo_SONATYPE_PASSWORD"
}
}
maven {
url releaseUrl
credentials {
username = "$System.env.bamboo_ARTIFACTORY_USERNAME"
password = "$System.env.bamboo_ARTIFACTORY_PASSWORD"
}
}
}
publications {
shadow(MavenPublication) {
from components.shadow
}
}
}
}
}