diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 981ec61af..933d438dc 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -219,43 +219,11 @@ void makeQuayNewImagesPublic() { } void createRelease() { - if (isReleaseExist()) { - deleteRelease() - } - - if (githubscm.isTagExist('origin', getGitTag())) { - githubscm.removeLocalTag(getGitTag()) - githubscm.removeRemoteTag('origin', getGitTag(), getGitAuthorCredsID()) - } - - def releaseName = "Kogito Images Version ${getProjectVersion()}" - def description = params.RELEASE_NOTES ?: "We are glad to announce that the Kogito ${getProjectVersion()} release is now available!" - withCredentials([string(credentialsId: env.GITHUB_TOKEN_CREDS_ID, variable: 'GITHUB_TOKEN')]) { - sh """ - export GITHUB_USER=${getGitAuthor()} - github-release release --tag ${getGitTag()} --target '${getBuildBranch()}' --name '${releaseName}' --description '${description}' --pre-release - """ - } -} - -boolean isReleaseExist() { - releaseExistStatus = -1 - withCredentials([string(credentialsId: env.GITHUB_TOKEN_CREDS_ID, variable: 'GITHUB_TOKEN')]) { - releaseExistStatus = sh(returnStatus: true, script: """ - export GITHUB_USER=${getGitAuthor()} - github-release info --tag ${getGitTag()} - """) - } - return releaseExistStatus == 0 -} - -void deleteRelease() { - withCredentials([string(credentialsId: env.GITHUB_TOKEN_CREDS_ID, variable: 'GITHUB_TOKEN')]) { - sh """ - export GITHUB_USER=${getGitAuthor()} - github-release delete --tag ${getGitTag()} - """ + if(githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsID())) { + githubscm.deleteReleaseAndTag(getGitTag(), getGitAuthorCredsID()) } + githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTag(getGitTag()), getGitAuthorCredsID()) + githubscm.updateReleaseBody(getGitTag(), getGitAuthorCredsID()) } String getOldImageFullTag(String imageName) {