Version tag may only be applied when all projects are "clean".

This commit is contained in:
Michael Lipp 2024-06-27 16:50:49 +02:00
parent b74de67c6d
commit e3da87d94f
4 changed files with 21 additions and 17 deletions

View file

@ -47,6 +47,7 @@ application {
project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
def registry = "${project.rootProject.properties['docker.registry']}"
def rootVersion = rootProject.version
task buildImage(type: Exec) {
dependsOn installDist
@ -70,7 +71,7 @@ task pushImage(type: Exec) {
task tagWithVersion(type: Exec) {
dependsOn pushImage
enabled = !project.version.contains("SNAPSHOT")
enabled = !rootVersion.contains("SNAPSHOT")
commandLine 'podman', 'push', \
"${project.name}:${project.gitBranch}",\
@ -80,9 +81,9 @@ task tagWithVersion(type: Exec) {
task tagAsLatest(type: Exec) {
dependsOn tagWithVersion
enabled = !project.version.contains("SNAPSHOT")
&& !project.version.contains("alpha") \
&& !project.version.contains("beta") \
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']