diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 9fdd39b273..cd4562b400 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -69,7 +69,7 @@ pipeline { } stage('Prepare for PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -138,7 +138,7 @@ pipeline { } stage('Create PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -148,11 +148,6 @@ pipeline { } else { println '[WARN] no changes to commit' } - - // Create a new tag - githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) - githubscm.tagRepository(getGitTagName()) - githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId()) } } } @@ -167,6 +162,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 { @@ -211,11 +226,7 @@ void checkoutRepo() { void commitAndCreatePR() { def commitMsg = "[${getBuildBranch()}] Update version to ${getProjectVersion()}" def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}." - if (isRelease()) { - prBody += '\nPlease do not merge, it should be merged automatically after testing.' - } else { - prBody += '\nPlease review and merge.' - } + prBody += '\nPlease review and merge.' githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) githubscm.commitChanges(commitMsg, { githubscm.findAndStageNotIgnoredFiles('pom.xml') }) githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId())