Skip to content

Commit d03dcb8

Browse files
committed
Verify tag to match version number
1 parent 14a9e2a commit d03dcb8

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ tasks.withType(JavaCompile).configureEach {
103103
it.options.release = 21
104104
}
105105

106+
tasks.register("verifyTagMatchesVersion") {
107+
doLast {
108+
def tag = project.findProperty("tag")?.toString()
109+
def version = project.findProperty("mod_version")?.toString()
110+
111+
if (tag == null || version == null) {
112+
throw new GradleException("Missing tag or mod_version.")
113+
}
114+
115+
if (tag != version) {
116+
throw new GradleException("Tag ($tag) does not match mod_version ($version)")
117+
}
118+
119+
println "✅ Tag matches mod_version: $version"
120+
}
121+
}
122+
106123
java {
107124
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
108125
// if it is present.

0 commit comments

Comments
 (0)