From b4719d2eb4018e02c21aeccc8a6f4ff6f57f646a Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Wed, 11 Sep 2024 16:35:03 +0200 Subject: [PATCH] Implemented support for custom gradle setting --- Jenkinsfile | 18 ++++++------------ build.gradle | 12 ++++++++++++ custom.properties | 11 +++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 custom.properties diff --git a/Jenkinsfile b/Jenkinsfile index b132ada..e74ad0a 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' } } } diff --git a/build.gradle b/build.gradle index 1a0b3f1..2096cd6 100644 --- a/build.gradle +++ b/build.gradle @@ -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() diff --git a/custom.properties b/custom.properties new file mode 100644 index 0000000..68f2405 --- /dev/null +++ b/custom.properties @@ -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 \ No newline at end of file