Added check for dirty worktree in Git.
This commit is contained in:
parent
d14fb67efd
commit
528ee76f70
1 changed files with 8 additions and 1 deletions
|
@ -104,9 +104,16 @@ tasks {
|
||||||
mustRunAfter("clean")
|
mustRunAfter("clean")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val gitIsDirty by creating(Exec::class) {
|
||||||
|
description = "Fails if git has uncommitted changes."
|
||||||
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
commandLine("git", "diff-index", "--quiet", "--HEAD", "--")
|
||||||
|
}
|
||||||
|
|
||||||
val gitTag by creating(Exec::class) {
|
val gitTag by creating(Exec::class) {
|
||||||
description = "Tags the local repository with version ${project.version}"
|
description = "Tags the local repository with version ${project.version}"
|
||||||
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
dependsOn(gitIsDirty)
|
||||||
commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}")
|
commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +196,6 @@ tasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
"release" {
|
"release" {
|
||||||
dependsOn(gitTag, generatePomFileForMavenJavaPublication, "bintrayUpload", "publishToMavenLocal")
|
dependsOn(generatePomFileForMavenJavaPublication, gitTag, "bintrayUpload", "publishToMavenLocal")
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue