File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -230,12 +230,21 @@ tasks {
230230 }
231231}
232232
233+ val versionPattern = " (?<ver>[\\ d.]+)-?(?<channel>beta)?\\ .?(?<mod>\\ d+)?\\ +?(?<game>[\\ d.]+)?(?:\\ +(?<dev>dev)?-?(?<hash>.+)?)?" .toRegex()
234+
233235publishMods {
234236 file.set(fullJar.flatMap { it.archiveFile })
235237 changelog.set(providers.environmentVariable(" CHANGELOG" ).orElse(" # $version " ))
236238 type.set(PUBLISH_RELEASE_TYPE .orElse(" alpha" ).map(ReleaseType ::of))
237239 modLoaders.add(" neoforge" )
238240 dryRun.set(! providers.environmentVariable(" CI" ).isPresent)
241+ displayName.set(version.map { s ->
242+ val matched = versionPattern.matchEntire(s) ? : throw IllegalArgumentException (" Unexpected version format" )
243+ val mainVer = matched.groups[" ver" ]?.value ? : throw IllegalArgumentException (" Missing main version" )
244+ val channelVer = matched.groups[" channel" ]?.value?.let { it + (matched.groups[" mod" ]?.value?.let { m -> " $m " } ? : " " ) } ? : " "
245+ val devHash = matched.groups[" hash" ]?.value?.let { " (dev $it )" } ? : " "
246+ " Connector $mainVer " + (if (channelVer.isNotEmpty()) " $channelVer " else " " ) + (if (devHash.isNotEmpty()) " $devHash " else " " )
247+ })
239248
240249 github {
241250 accessToken.set(providers.environmentVariable(" GITHUB_TOKEN" ))
You can’t perform that action at this time.
0 commit comments