Skip to content

Commit cb875ad

Browse files
committed
Updated the gradle build.
1 parent 6badb43 commit cb875ad

File tree

2 files changed

+53
-7
lines changed

2 files changed

+53
-7
lines changed

build.gradle

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
buildscript {
22
repositories {
33
maven { url "https://repo.grails.org/grails/core" }
4+
maven { url "https://plugins.gradle.org/m2" }
45
}
56
dependencies {
67
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
78
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.3.4"
89
classpath "org.grails.plugins:hibernate5:7.2.0"
10+
classpath "io.github.gradle-nexus:publish-plugin:1.0.0"
911
}
1012
}
1113

12-
version "3.1.0"
13-
group "org.grails.plugins"
14+
group "io.github.gpc"
1415

1516
apply plugin: "eclipse"
1617
apply plugin: "idea"
1718
apply plugin: "org.grails.grails-plugin"
1819
apply plugin: "asset-pipeline"
1920
apply plugin: "org.grails.grails-gsp"
2021
apply plugin: "maven-publish"
21-
//apply plugin: "signing"
22+
apply plugin: "signing"
23+
apply plugin: "io.github.gradle-nexus.publish-plugin"
2224

2325
repositories {
2426
maven { url "https://repo.grails.org/grails/core" }
@@ -121,7 +123,7 @@ publishing {
121123
pom {
122124
name = 'Grails Asynchronous Mail Plugin'
123125
description = 'The plugin realises asynchronous mail sending. It stores messages in a DB and sends them asynchronously by a quartz job.'
124-
url = 'https://github.com/matrei/grails-asynchronous-mail'
126+
url = 'https://github.com/gpc/grails-asynchronous-mail'
125127
licenses {
126128
license {
127129
name = 'The Apache License, Version 2.0'
@@ -187,11 +189,54 @@ publishing {
187189
}
188190
}
189191
scm {
190-
connection = 'scm:git:git://github.com/matrei/grails-asynchronous-mail.git'
191-
developerConnection = 'scm:git:ssh://github.com:matrei/grails-asynchronous-mail.git'
192-
url = 'https://github.com/matrei/grails-asynchronous-mail'
192+
connection = 'scm:git:git://github.com/gpc/grails-asynchronous-mail.git'
193+
developerConnection = 'scm:git:ssh://github.com:gpc/grails-asynchronous-mail.git'
194+
url = 'https://github.com/gpc/grails-asynchronous-mail'
193195
}
194196
}
195197
}
196198
}
197199
}
200+
201+
ext."signing.keyId" = project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY_ID')
202+
ext."signing.password" = project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')
203+
ext."signing.secretKeyRingFile" = project.findProperty('signing.secretKeyRingFile') ?: (System.getenv('SIGNING_PASSPHRASE') ?: "${System.getProperty('user.home')}/.gnupg/secring.gpg")
204+
205+
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
206+
207+
afterEvaluate {
208+
signing {
209+
required { isReleaseVersion }
210+
sign publishing.publications.maven
211+
}
212+
}
213+
214+
tasks.withType(Sign) {
215+
onlyIf { isReleaseVersion }
216+
}
217+
218+
nexusPublishing {
219+
repositories {
220+
sonatype {
221+
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.findProperty('sonatypeOss2Username') ?: ''
222+
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.findProperty("sonatypeOss2Password") ?: ''
223+
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.findProperty("sonatypeOssStagingProfileIdJms") ?: ''
224+
225+
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
226+
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
227+
username = ossUser
228+
password = ossPass
229+
stagingProfileId = ossStagingProfileId
230+
}
231+
}
232+
}
233+
234+
task snapshotVersion {
235+
doLast {
236+
if(!project.version.endsWith('-SNAPSHOT')) {
237+
ant.propertyfile(file: "gradle.properties") {
238+
entry(key: "version", value: "${project.version}-SNAPSHOT")
239+
}
240+
}
241+
}
242+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version=3.1.0-SNAPSHOT
12
grailsVersion=5.1.1
23
grailsGradlePluginVersion=5.1.0
34
groovyVersion=3.0.7

0 commit comments

Comments
 (0)