-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
publish-root.gradle
48 lines (44 loc) · 1.65 KB
/
publish-root.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
// Create variables with empty default values
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.key"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''
if (SIGNING_KEY_ID != null) {
// Use global gradle variables
ext["ossrhUsername"] = OSSRH_USERNAME
ext["ossrhPassword"] = OSSRH_PASSWORD
ext["sonatypeStagingProfileId"] = SONATYPE_STAGING_PROFILE_ID
ext["signing.keyId"] = SIGNING_KEY_ID
ext["signing.password"] = SIGNING_PASSWORD
ext["signing.key"] = SIGNING_KEY
ext["snapshot"] = LINK_PREVIEW_SNAPSHOT
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.key"] = System.getenv('SIGNING_KEY')
ext["snapshot"] = System.getenv('LINK_PREVIEW_SNAPSHOT')
}
if (snapshot) {
ext["rootVersionName"] = LINK_PREVIEW_SNAPSHOT_VERSION_NAME
} else {
ext["rootVersionName"] = LINK_PREVIEW_VERSION_NAME
}
// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
version = rootVersionName
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}