Implemented support for custom gradle setting

This commit is contained in:
Ziver Koc 2024-09-11 16:35:03 +02:00
parent e9ccfd15de
commit b4719d2eb4
3 changed files with 29 additions and 12 deletions

18
Jenkinsfile vendored
View file

@ -13,12 +13,6 @@ pipeline {
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build') {
steps{
withGradle {
@ -27,7 +21,7 @@ pipeline {
}
}
}
/*
stage('Test') {
steps {
withGradle {
@ -35,16 +29,16 @@ pipeline {
}
}
}
*/
stage('Deploy') {
steps {
withGradle {
configFileProvider([configFile(fileId: '70cb2022-0bc2-4b25-98a4-e1526dbf2735')]) {
sh 'GPG_TTY=$(tty) ./gradlew ${gradleParams} sign'
configFileProvider([configFile(fileId: '70cb2022-0bc2-4b25-98a4-e1526dbf2735', variable: 'GRADLE_PROPERTIES')]) {
sh 'GPG_TTY=$(tty) ./gradlew ${gradleParams} -PcustomProperties=${GRADLE_PROPERTIES} sign'
sh "./gradlew ${gradleParams} publishToMavenLocal"
sh './gradlew ${gradleParams} publishToMavenLocal'
sh './gradlew ${gradleParams} -Prelease publish'
sh './gradlew ${gradleParams} -Prelease -PcustomProperties=${GRADLE_PROPERTIES} publish'
}
}
}

View file

@ -5,6 +5,18 @@ plugins {
apply from: 'build_publish.gradle'
// Load custom properties
if (project.hasProperty('customProperties')) {
project.logger.info("Loading custom properties from: ${project.property('customProperties')}")
def props = new Properties()
file(project.property('customProperties')).withInputStream { props.load(it) }
props.each {key, value ->
project.logger.info("Updating property: ${key}")
project.ext[key] = value
}
}
repositories {
mavenLocal()
mavenCentral()

11
custom.properties Normal file
View file

@ -0,0 +1,11 @@
# ~/.gradle/gradle.properties
SONATYPE_NEXUS_USERNAME=RkGxVN2E
SONATYPE_NEXUS_PASSWORD=
signing.keyId=21038C46
signing.password=
signing.gnupg.keyName=21038C46
signing.gnupg.passphrase=
signing.gnupg.useLegacyGpg=true