Skip to content

Commit 2f10e6b

Browse files
committed
build: use env vars for publish credentials
1 parent ee89a3a commit 2f10e6b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

gradle/publishing.gradle

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ext.set('signing.password', findProperty('signing.password') ?: System.getenv('S
66
def javaComponent = components.named('java')
77
publishing {
88
publications {
9-
register('grailsMailPlugin', MavenPublication) {
9+
register('grailsPlugin', MavenPublication) {
1010
from javaComponent.get()
1111
versionMapping {
1212
usage('java-api') { fromResolutionOf('runtimeClasspath') }
@@ -89,16 +89,16 @@ publishing {
8989
repositories {
9090
maven {
9191
credentials {
92-
username = findProperty('artifactoryPublishUsername') ?: ''
93-
password = findProperty('artifactoryPublishPassword') ?: ''
92+
username = System.getenv('MAVEN_PUBLISH_USERNAME')
93+
password = System.getenv('MAVEN_PUBLISH_PASSWORD')
9494
}
95-
url = uri('https://repo.grails.org/grails/plugins3-snapshots-local')
95+
url = uri(System.getenv('MAVEN_PUBLISH_URL') ?: '')
9696
}
9797
}
9898
}
9999
}
100100

101-
def mavenPublication = extensions.findByType(PublishingExtension).publications.named('grailsMailPlugin')
101+
def mavenPublication = extensions.findByType(PublishingExtension).publications.named('grailsPlugin')
102102
tasks.withType(Sign).configureEach {
103103
onlyIf { isReleaseVersion }
104104
}
@@ -111,15 +111,12 @@ afterEvaluate {
111111

112112
if (isReleaseVersion) {
113113
nexusPublishing {
114-
String sonatypeUsername = findProperty('sonatypeUsername') ?: ''
115-
String sonatypePassword = findProperty('sonatypePassword') ?: ''
116-
String sonatypeStagingProfileId = findProperty('sonatypeStagingProfileId') ?: ''
117114
repositories {
118115
sonatype {
119-
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
120-
username = sonatypeUsername
121-
password = sonatypePassword
122-
stagingProfileId = sonatypeStagingProfileId
116+
nexusUrl = uri(System.getenv('NEXUS_PUBLISH_URL'))
117+
username = System.getenv('NEXUS_PUBLISH_USERNAME')
118+
password = System.getenv('NEXUS_PUBLISH_PASSWORD')
119+
stagingProfileId = System.getenv('NEXUS_PUBLISH_STAGING_PROFILE_ID')
123120
}
124121
}
125122
}

0 commit comments

Comments
 (0)