Push to github atomically and only if the release succeeds
This commit is contained in:
parent
02abce69fa
commit
1ad029c6d9
|
@ -302,7 +302,6 @@ task addVersionCommit( dependsOn: [releaseChecks] ) {
|
||||||
logger.lifecycle( "Adding commit to update version to '${project.releaseVersion}'..." )
|
logger.lifecycle( "Adding commit to update version to '${project.releaseVersion}'..." )
|
||||||
executeGitCommand( 'add', '.' )
|
executeGitCommand( 'add', '.' )
|
||||||
executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
|
executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
|
||||||
executeGitCommand( 'push', project.gitRemote )
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release.mustRunAfter addVersionCommit
|
release.mustRunAfter addVersionCommit
|
||||||
|
@ -311,21 +310,29 @@ task ciRelease( dependsOn: [releaseChecks, addVersionCommit, release] ) {
|
||||||
group = "Release"
|
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."
|
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."
|
||||||
doLast {
|
doLast {
|
||||||
|
String tag = null
|
||||||
if ( !project.hasProperty( 'noTag' ) ) {
|
if ( !project.hasProperty( 'noTag' ) ) {
|
||||||
String tag = project.ormVersion.fullName
|
tag = project.ormVersion.fullName
|
||||||
// the release is tagged and the tag is pushed to github
|
// the release is tagged and the tag is pushed to github
|
||||||
if ( tag.endsWith( ".Final" ) ) {
|
if ( tag.endsWith( ".Final" ) ) {
|
||||||
tag = tag.replace( ".Final", "" )
|
tag = tag.replace( ".Final", "" )
|
||||||
}
|
}
|
||||||
logger.lifecycle( "Tagging '${tag}'..." )
|
logger.lifecycle( "Tagging '${tag}'..." )
|
||||||
executeGitCommand( 'tag', tag )
|
executeGitCommand( 'tag', tag )
|
||||||
executeGitCommand( 'push', project.gitRemote, tag )
|
}
|
||||||
|
|
||||||
logger.lifecycle( "Adding commit to update version to '${project.developmentVersion}'..." )
|
logger.lifecycle( "Adding commit to update version to '${project.developmentVersion}'..." )
|
||||||
project.ormVersionFile.text = "hibernateVersion=${project.developmentVersion}"
|
project.ormVersionFile.text = "hibernateVersion=${project.developmentVersion}"
|
||||||
executeGitCommand( 'add', '.')
|
executeGitCommand( 'add', '.')
|
||||||
executeGitCommand( 'commit', '-m', project.developmentVersion )
|
executeGitCommand( 'commit', '-m', project.developmentVersion )
|
||||||
executeGitCommand( 'push', project.gitRemote )
|
|
||||||
|
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 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue