prepare for 6.0.0.Alpha8

This commit is contained in:
Steve Ebersole 2021-05-18 15:50:10 -05:00
parent 5ae9e9fb7e
commit 2e1ebfc4da
1 changed files with 88 additions and 40 deletions

View File

@ -260,7 +260,7 @@ artifacts {
task releaseChecks {
group 'Release'
description
description 'Checks and preparation for release'
}
task changeLogFile {
@ -270,40 +270,82 @@ task changeLogFile {
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
logger.lifecycle( "Appending version `${project.releaseVersion}` to changelog..." )
ChangeLogFile.update( ormVersion.fullName );
}
}
task addVersionCommit {
group "Release"
description "Adds a commit for setting the released version"
task changeToReleaseVersion {
group 'Release'
description 'Updates `gradle/version.properties` file to the specified release-version'
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Updating version to '${project.releaseVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}"
logger.lifecycle( "Adding commit to update version to '${project.releaseVersion}'..." )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
logger.lifecycle( "Updating version-file to release-version : `${project.releaseVersion}`" )
updateVersionFile( project.releaseVersion )
}
}
task gitPreparationForRelease {
dependsOn changeLogFile
dependsOn changeToReleaseVersion
doLast {
logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', "Pre-steps for release : `${project.ormVersion.fullName}`" )
}
}
task changeToDevelopmentVersion {
group 'Release'
description 'Updates `gradle/version.properties` file to the specified development-version'
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Updating version-file to development-version : `${project.developmentVersion}`" )
updateVersionFile( project.developmentVersion )
}
}
task gitTasksAfterRelease {
dependsOn changeToDevelopmentVersion
doLast {
logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', "Post-steps for release : `${project.ormVersion.fullName}`" )
if ( project.releaseTag != '' ) {
logger.lifecycle("Tagging release : `${project.releaseTag}`...")
executeGitCommand( 'tag', project.releaseTag )
}
}
}
void updateVersionFile(String version) {
logger.lifecycle( "Updating `gradle/version.properties` version to `${version}`" )
project.ormVersionFile.text = "hibernateVersion=${version}"
}
task publishReleaseArtifacts {
dependsOn releaseChecks
dependsOn uploadDocumentation
dependsOn uploadBundlesSourceForge
mustRunAfter gitPreparationForRelease
}
task release {
group 'Release'
description 'Performs a release on local check-out, including updating changelog and '
dependsOn changeLogFile
dependsOn addVersionCommit
dependsOn gitPreparationForRelease
dependsOn publishReleaseArtifacts
finalizedBy gitTasksAfterRelease
}
rootProject.subprojects.each { Project subProject ->
@ -320,6 +362,21 @@ task ciReleaseChecks {
dependsOn releaseChecks
}
task gitTasksAfterCiRelease {
dependsOn gitTasksAfterRelease
doLast {
if ( project.createTag ) {
logger.lifecycle( "Pushing branch and tag to remote `${project.gitRemote}`..." )
executeGitCommand( 'push', '--atomic', project.gitRemote , project.gitBranch, project.releaseTag )
}
else {
logger.lifecycle("Pushing branch to remote `${project.gitRemote}`..." )
executeGitCommand( 'push', project.gitRemote , project.gitBranch )
}
}
}
task 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.'
@ -327,34 +384,8 @@ task ciRelease {
dependsOn ciReleaseChecks
dependsOn release
doLast {
String tag = null
if ( !project.hasProperty( 'noTag' ) ) {
tag = project.ormVersion.fullName
// the release is tagged and the tag is pushed to github
if ( tag.endsWith( ".Final" ) ) {
tag = tag.replace( ".Final", "" )
finalizedBy gitTasksAfterCiRelease
}
logger.lifecycle( "Tagging '${tag}'..." )
executeGitCommand( 'tag', tag )
}
logger.lifecycle( "Adding commit to update version to '${project.developmentVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.developmentVersion}"
executeGitCommand( 'add', '.')
executeGitCommand( 'commit', '-m', project.developmentVersion )
if ( tag != null ) {
logger.lifecycle("Pushing branch and tag to remote '${project.gitRemote}'...")
executeGitCommand( 'push', '--atomic', project.gitRemote , project.gitBranch, tag )
}
else {
logger.lifecycle("Pushing branch to remote '${project.gitRemote}'...")
executeGitCommand( 'push', project.gitRemote , project.gitBranch )
}
}
}
ciRelease.mustRunAfter addVersionCommit
static String executeGitCommand(Object ... subcommand){
List<Object> command = ['git']
@ -490,8 +521,11 @@ gradle.getTaskGraph().whenReady {tg->
project.ext {
releaseVersion = project.property( 'releaseVersion' )
developmentVersion = project.property( 'developmentVersion' )
createTag = ! project.hasProperty( 'noTag' )
releaseTag = determineReleaseTag( project )
}
logger.lifecycle( "Checking that the working tree is clean..." )
String uncommittedFiles = executeGitCommand( 'status', '--porcelain' )
if ( !uncommittedFiles.isEmpty() ) {
@ -535,3 +569,17 @@ gradle.getTaskGraph().whenReady {tg->
}
}
static String determineReleaseTag(Project project) {
if ( ! project.hasProperty( 'noTag' ) ) {
return "";
}
final String tag = project.ormVersion.fullName
if ( tag.endsWith( ".Final" ) ) {
return tag.replace( ".Final", "" )
}
return tag;
}