diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 8f32664d194..b503afb8ab5 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -82,7 +82,7 @@ pipeline { } stage('Prepare for PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -149,7 +149,7 @@ pipeline { } stage('Create PR') { when { - expression { return isRelease() || isCreatePr() } + expression { return isCreatePr() } } steps { script { @@ -159,11 +159,6 @@ pipeline { } else { println '[WARN] no changes to commit' } - - // Create a new tag - githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) - githubscm.tagRepository(getGitTagName()) - githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId()) } } } @@ -178,6 +173,29 @@ 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') + githubscm.findAndStageNotIgnoredFiles('antora.yml') + }) + } else { + println '[WARN] no changes to commit' + } + githubscm.tagRepository(getGitTagName()) + githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId()) + } + } + } + } } post { always {