From c2a4c046eb2c92459b5ed51c1577c660b9b16f5e Mon Sep 17 00:00:00 2001 From: Rodrigo Antunes Date: Mon, 29 Jul 2024 08:03:17 -0300 Subject: [PATCH] Adjust git tag creation for Apache 10 release (#3592) --- .ci/jenkins/Jenkinsfile.deploy | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 034cce9841a..6dfa58756e1 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -90,7 +90,7 @@ pipeline { } stage('Prepare for PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -160,7 +160,6 @@ pipeline { mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE) .run("clean $installOrDeploy") } - } } } @@ -175,7 +174,7 @@ pipeline { } stage('Create PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -185,11 +184,6 @@ pipeline { } else { println '[WARN] no changes to commit' } - - // Create a new tag - githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) - githubscm.tagRepository(getGitTagName()) - githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId()) } } } @@ -204,6 +198,26 @@ pipeline { } } } + stage('Commit and Create Tag') { + when { + expression { return isRelease() } + } + steps { + script { + dir(getRepoName()) { + if (githubscm.isThereAnyChanges()) { + def commitMsg = "[${getBuildBranch()}] Update version to ${getProjectVersion()}" + githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) + githubscm.commitChanges(commitMsg, { githubscm.findAndStageNotIgnoredFiles('pom.xml') }) + } else { + println '[WARN] no changes to commit' + } + githubscm.tagRepository(getGitTagName()) + githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId()) + } + } + } + } } post { always {