Skip to content

Commit 6d3b9ba

Browse files
committed
feat: add determineModrinthVersionType function to classify version types
1 parent 76afb1e commit 6d3b9ba

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ def writeModrinthBodyFile = { String text ->
139139
return outFile
140140
}
141141

142+
def determineModrinthVersionType = { String releaseTag ->
143+
if (!releaseTag) return 'alpha'
144+
def tagLower = releaseTag.toLowerCase()
145+
if (tagLower.contains('snapshot') || tagLower.contains('dev') || tagLower.contains('alpha') || tagLower.matches(/v?\d+\.\d+(-?a|alpha).*/)) {
146+
return 'alpha'
147+
}
148+
if (tagLower.contains('beta') || tagLower.matches(/v?\d+\.\d+(-?b|beta).*/)) {
149+
return 'beta'
150+
}
151+
if (tagLower.contains('rc') || tagLower.matches(/v?\d+\.\d+(-?rc).*/)) {
152+
return 'beta'
153+
}
154+
155+
return 'release'
156+
}
157+
142158
modrinth {
143159
token = System.getenv("MODRINTH_TOKEN")
144160
projectId = "noctisui"
@@ -149,7 +165,10 @@ modrinth {
149165
loaders = ["fabric"]
150166

151167
def modrinthBody = fetchReleaseDescription(tag)
152-
syncBodyFrom = writeModrinthBodyFile(modrinthBody).absolutePath
168+
syncBodyFrom = writeModrinthBodyFile(modrinthBody)
169+
170+
versionType = determineModrinthVersionType(tag)
171+
logger.lifecycle("modrinth: determined versionType=${versionType} for tag=${tag}")
153172
}
154173

155174
tasks.register('printModrinthBody') {

0 commit comments

Comments
 (0)