From d5403f6e88573e9f4856320c2626ac0f5253c8f0 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 4 Oct 2023 23:02:22 +0200 Subject: [PATCH] HHH-17239 Automate maintenance releases --- build.gradle | 1 + release/release.gradle | 54 ++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index b22ee53a89..a85f55ee25 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,7 @@ plugins { id 'idea' id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0' id 'eclipse' + id "com.dorongold.task-tree" version "2.1.1" } apply from: file( 'gradle/module.gradle' ) diff --git a/release/release.gradle b/release/release.gradle index 6b2f8adf32..864394e8fa 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -318,7 +318,7 @@ def changeToDevelopmentVersionTask = tasks.register( 'changeToDevelopmentVersion } } -def gitTasksAfterReleaseTask = tasks.register( 'gitTasksAfterRelease' ) { +def releasePreparePostGitTask = tasks.register( 'gitTasksAfterRelease' ) { dependsOn changeToDevelopmentVersionTask doLast { @@ -345,22 +345,7 @@ def publishReleaseArtifactsTask = tasks.register( 'publishReleaseArtifacts' ) { dependsOn uploadDocumentationDescriptor } -def releaseTask = tasks.register( 'release' ) { - group 'Release' - description 'Performs a release on local check-out, including updating changelog and ' - - dependsOn gitPreparationForReleaseTask - dependsOn publishReleaseArtifactsTask - - finalizedBy gitTasksAfterReleaseTask -} - -def ciReleaseChecksTask = tasks.register( 'ciReleaseChecks' ) { - -} - -def gitTasksAfterCiReleaseTask = tasks.register( 'gitTasksAfterCiRelease' ) { - dependsOn gitTasksAfterReleaseTask +def releasePerformPostGitTask = tasks.register( 'gitTasksAfterReleasePerform' ) { doLast { if ( project.createTag ) { @@ -374,14 +359,37 @@ def gitTasksAfterCiReleaseTask = tasks.register( 'gitTasksAfterCiRelease' ) { } } +def releasePrepareTask = tasks.register( 'releasePrepare' ) { + group 'Release' + description 'Performs release preparations on local check-out, including updating changelog' + + dependsOn gitPreparationForReleaseTask + + finalizedBy releasePreparePostGitTask +} + +def releasePerformTask = tasks.register( 'releasePerform' ) { + group 'Release' + description 'Performs a release on local check-out, including updating changelog and ' + + dependsOn publishReleaseArtifactsTask + + finalizedBy releasePerformPostGitTask +} + +def releaseTask = tasks.register( 'release' ) { + group 'Release' + description 'Performs a release on local check-out, including updating changelog and ' + + dependsOn releasePrepareTask + dependsOn releasePerformTask +} + def ciReleaseTask = tasks.register( 'ciRelease' ) { group 'Release' description 'Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one.' - dependsOn ciReleaseChecksTask dependsOn releaseTask - - finalizedBy gitTasksAfterCiReleaseTask } static String executeGitCommand(Object ... subcommand){ @@ -512,9 +520,9 @@ gradle.getTaskGraph().whenReady {tg-> String releaseVersionLocal String developmentVersionLocal - def console = tg.hasTask( project.tasks.ciReleaseChecks ) - ? null - : System.console() + def console = tg.hasTask( project.tasks.release ) && !tg.hasTask( project.tasks.ciRelease ) + ? System.console() + : null if (project.hasProperty('releaseVersion')) { releaseVersionLocal = project.property('releaseVersion')