Skip to content

Commit

Permalink
Making changes to sign and publish to maven central.
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualdogbert committed Jan 17, 2022
1 parent 4f81dd1 commit ef371a7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 27 deletions.
83 changes: 56 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

plugins {
id 'groovy'
id 'maven-publish'
id "com.jfrog.bintray" version "1.8.4"
id "org.asciidoctor.gradle.asciidoctor" version "1.5.1"
id 'idea'
id 'signing'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}

// sourceCompatibility has to be placed after applying the Groovy (Java) Plugin:
Expand All @@ -21,9 +21,8 @@ wrapper {
}



repositories {
jcenter()
mavenCentral()
}

sourceSets {
Expand Down Expand Up @@ -53,7 +52,6 @@ task sourceJar(type: Jar) {
}



ext {
theTitle = 'Groovy Config Writer'
titleForDocumentation = archivesBaseName + ' ' + version
Expand Down Expand Up @@ -101,7 +99,12 @@ groovydoc {

publishing {
publications {
groovyMaven(MavenPublication) {
maven(MavenPublication) {

groupId = project.group
artifactId = 'GroovyConfigWriter'
version = project.version

from components.java

artifact(sourceJar) {
Expand All @@ -111,6 +114,30 @@ publishing {
artifact jarDoc {
classifier = 'javadoc'
}

pom {
name = 'Groovy Config Writer'
description = 'This library provides a writer for Groovy base configuration, that can be parsed by the ConfigSlurper.'
url = 'https://github.com/virtualdogbert/groovyConfigWriter'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'virtualdogbert'
name = 'Tucker J. Pelletier'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/virtualdogbert/groovyConfigWriter.git'
developerConnection = 'scm:git:ssh://github.com:virtualdogbert/groovyConfigWriter.git'
url = 'https://github.com/virtualdogbert/groovyConfigWriter/tree/master'
}
}
}


Expand All @@ -127,27 +154,6 @@ artifacts {
archives(jarDoc)
}


bintray {

user = getPropertyOrUseDefault("bintrayUser", "fake_user")
key = getPropertyOrUseDefault("bintrayKey", "fake_key")
publications = ['groovyMaven']

def projectName = project.name
def projectDescription = project.description

pkg {
repo = 'maven'
name = 'GroovyConfigWriter'
desc = 'This library provides a writer for Groovy base configuration, that can be parsed buy the ConfigSlurper.'
issueTrackerUrl = "https://github.com/virtualdogbert/GroovyConfigWriter/issues"
vcsUrl = "https://github.com/virtualdogbert/GroovyConfigWriter/"
websiteUrl = "https://virtualdogbert.github.io/GroovyConfigWriter"
licenses = ['Apache-2.0']
}
}

String getPropertyOrUseDefault(String propertyName, String defaultValue) {
hasProperty(propertyName) ? getProperty(propertyName) : defaultValue
}
Expand Down Expand Up @@ -200,3 +206,26 @@ task docs(dependsOn: [asciidoc]) {
include '**/*.png'
}
}


afterEvaluate {
signing {
//required { gradle.taskGraph.hasTask("publish") || gradle.taskGraph.hasTask("publishMavenPublicationToMavenLocal") }
sign publishing.publications.maven
}
}

nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
signingKeyId=""
signingPassword=""
signingSecretKeyRingFile=""
isReleaseVersion=""

0 comments on commit ef371a7

Please sign in to comment.