Skip to content

Commit

Permalink
Add sign
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Apr 23, 2024
1 parent 4142f3b commit 2b1a7f1
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 19 deletions.
46 changes: 38 additions & 8 deletions base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'

buildscript {
repositories {
Expand Down Expand Up @@ -64,19 +65,20 @@ configurations {
publishing {
repositories {
mavenLocal()

maven {
url = libraryRepo
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("GITHUB_DEPLOY_USER") ?: System.properties['deploy.user']
password = System.getenv("GITHUB_DEPLOY_TOKEN") ?: System.properties['deploy.token']
username = findProperty("sonatypeUsername")
password = findProperty("sonatypePassword")
}
}
}
publications {
maven(MavenPublication) {
mavenJava(MavenPublication) {
groupId = publishGroupId
artifactId = 'adempiere-patches.' + packageName
version = patchVersion
version = version
from components.java
pom {
name = 'Adempiere Patch ${packageName}'
Expand All @@ -90,12 +92,40 @@ publishing {
}
developers {
developer {
id = 'cParada'
name = 'Carlos Parada'
email = 'cparada@erpya.com'
id = 'yamelsenih'
name = 'Yamel Senih'
email = 'ysenih@erpya.com'
}
}
scm {
connection = 'scm:git:git://github.com/adempiere/adempiere-payroll-multi-engine.git'
developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-payroll-multi-engine.git'
url = 'http://github.com/adempiere/adempiere-payroll-multi-engine'
}
}
}
}
}

task cleanBuildPublishLocal(type: GradleBuild) {
tasks = ['clean', 'build', 'publishToMavenLocal']
}


signing {
def isReleaseVersion = !version.toString().startsWith("local") && !version.toString().endsWith("-SNAPSHOT")

sign configurations.archives

setRequired {
// signing is required if this is a release version and the artifacts are to be published
// do not use hasTask() as this require realization of the tasks that maybe are not necessary
(isReleaseVersion || version.toString().equals("build")) && gradle.taskGraph.allTasks.any {
it.equals(PublishToMavenRepository)
}
}
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
50 changes: 39 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'

repositories {
mavenLocal()
Expand Down Expand Up @@ -69,24 +70,23 @@ jar {
}
}


publishing {
repositories {
mavenLocal()

maven {
url = libraryRepo
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("GITHUB_DEPLOY_USER") ?: System.properties['deploy.user']
password = System.getenv("GITHUB_DEPLOY_TOKEN") ?: System.properties['deploy.token']
username = findProperty("sonatypeUsername")
password = findProperty("sonatypePassword")
}
}
}

publications {
maven(MavenPublication) {
mavenJava(MavenPublication) {
groupId = publishGroupId
artifactId = 'adempiere-patches'
version = patchVersion
version = version
from components.java
pom {
name = 'Adempiere Patches'
Expand All @@ -100,12 +100,40 @@ publishing {
}
developers {
developer {
id = 'cparada'
name = 'Carlos Parada'
email = 'cparada@erpya.com'
id = 'yamelsenih'
name = 'Yamel Senih'
email = 'ysenih@erpya.com'
}
}
scm {
connection = 'scm:git:git://github.com/adempiere/adempiere-payroll-multi-engine.git'
developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-payroll-multi-engine.git'
url = 'http://github.com/adempiere/adempiere-payroll-multi-engine'
}
}
}
}
}
}

task cleanBuildPublishLocal(type: GradleBuild) {
tasks = ['clean', 'build', 'publishToMavenLocal']
}


signing {
def isReleaseVersion = !version.toString().startsWith("local") && !version.toString().endsWith("-SNAPSHOT")

sign configurations.archives

setRequired {
// signing is required if this is a release version and the artifacts are to be published
// do not use hasTask() as this require realization of the tasks that maybe are not necessary
(isReleaseVersion || version.toString().equals("build")) && gradle.taskGraph.allTasks.any {
it.equals(PublishToMavenRepository)
}
}
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}

0 comments on commit 2b1a7f1

Please sign in to comment.