From f7b764300851a1e2b1cfd5f6d3346912495e8312 Mon Sep 17 00:00:00 2001 From: Stav Shamir Date: Mon, 27 Sep 2021 15:57:58 +0300 Subject: [PATCH] Update version and publish to sonatype instead of bintray --- .gitignore | 1 + build.gradle | 63 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index fb914f5..b1d8a78 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ testem.log # System Files .DS_Store Thumbs.db +/gradle.properties diff --git a/build.gradle b/build.gradle index 95826fe..1099275 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ plugins { id 'java' id 'com.github.node-gradle.node' version '2.2.4' + id 'signing' id 'maven-publish' - id 'com.jfrog.bintray' version '1.8.5' } -group = 'io.github.stavshamir' -version = '0.0.2' +group = 'io.github.springwolf' +version = '0.1.1' + (Boolean.valueOf(System.getProperty('snapshot')) ? '-SNAPSHOT' : '') sourceCompatibility = '1.8' node { @@ -38,6 +38,9 @@ artifacts { archives sourcesJar } +signing { + sign configurations.archives +} def pomConfig = { licenses { @@ -62,7 +65,7 @@ def pomConfig = { publishing { publications { - mavenPublication(MavenPublication) { + mavenJava(MavenPublication) { artifact jar artifact sourcesJar { @@ -78,26 +81,46 @@ publishing { root.appendNode('name', 'springwolf-ui') root.appendNode('url', 'https://github.com/springwolf/springwolf-ui') root.children().last() + pomConfig + + def pomFile = file("${project.buildDir}/generated-pom.xml") + writeTo(pomFile) + def pomAscFile = signing.sign(pomFile).signatureFiles[0] + artifact(pomAscFile) { + classifier = null + extension = 'pom.asc' + } + } + + project.tasks.signArchives.signatureFiles.each { + artifact(it) { + def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/ + if (matcher.find()) { + classifier = matcher.group(1) + } else { + classifier = null + } + extension = 'jar.asc' + } } } } -} -bintray { - user = System.getProperty('bintray.user') - key = System.getProperty('bintray.key') - publications = ['mavenPublication'] - - pkg { - repo = 'springwolf' - name = 'springwolf-ui' - userOrg = 'stavshamir' - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/springwolf/springwolf-ui.git' - version { - name = project.version - desc = 'Web UI for Springwolf' - released = new Date() + repositories { + maven { + url 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' + credentials { + username = ossrhUsername + password = ossrhPassword + } + } + } + + model { + tasks.publishMavenJavaPublicationToMavenLocal { + dependsOn project.tasks.signArchives + } + tasks.publishMavenJavaPublicationToMavenRepository { + dependsOn project.tasks.signArchives } } }