Skip to content

Commit

Permalink
Merge branch '1.21.3-neoforge' into 1.21-neoforge
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Nov 19, 2024
2 parents a76cab0 + 1b3a00b commit 7f53e18
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,25 @@ spotless {
}
}

def getGhVersion() {
return "v" + version.substring(0, version.indexOf("-MC"))
}

def getChangelogUrl() {
def modSlug = mod_name.toLowerCase().replace(" ", "-")
def versionSlug = version.substring(0, version.indexOf("-MC")).replace(".", "-")
return "https://www.wimods.net/${modSlug}/${modSlug}-${versionSlug}/"
}

publishMods {
file = tasks.named("renameJarJar").flatMap { task ->
def libsDir = layout.buildDirectory.dir("libs").get().asFile
def jarFiles = libsDir.listFiles().findAll { it.name.endsWith(".jar") }
layout.file(providers.provider { jarFiles[0] })
}
def versionString = project.version as String
def ghVersion = "v" + versionString.substring(0, versionString.indexOf("-MC"))
def changelogUrl = "https://www.wimods.net/chestesp/chestesp-1-2/"
type = ghVersion.contains("pre") ? BETA : STABLE
type = getGhVersion().contains("pre") ? BETA : STABLE
modLoaders.add("neoforge")
def changelogUrl = getChangelogUrl()

curseforge {
projectId = "870203"
Expand Down Expand Up @@ -298,9 +306,9 @@ task github {
doLast {
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
def repository = github.getRepository("Wurst-Imperium-MCX/ChestESP")
def ghVersion = "v" + version.substring(0, version.indexOf("-MC"))
def ghVersion = getGhVersion()

def ghRelease = repository.getReleaseByTagName(ghVersion as String);
def ghRelease = repository.getReleaseByTagName(ghVersion as String)
if(ghRelease == null) {
def releaseBuilder = new GHReleaseBuilder(repository, ghVersion as String)
releaseBuilder.prerelease(ghVersion.contains("pre"))
Expand Down Expand Up @@ -328,8 +336,7 @@ task closeMilestone {
doLast {
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
def repository = github.getRepository("Wurst-Imperium/ChestESP")
def ghVersion = "v" + version.substring(0, version.indexOf("-MC"))
def versionSlug = ghVersion.substring(1).replace('.', '-')
def ghVersion = getGhVersion()

// Weird API design: listMilestones() requires GHIssueState while everything else uses GHMilestoneState.
def milestone = repository.listMilestones(GHIssueState.ALL).find { it.title == ghVersion }
Expand All @@ -339,7 +346,7 @@ task closeMilestone {

if (milestone.getState() != GHMilestoneState.CLOSED) {
milestone.setDueOn(Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()))
milestone.setDescription("https://wimods.net/chestesp/chestesp-${versionSlug}/")
milestone.setDescription(getChangelogUrl())
milestone.close()
}
}
Expand All @@ -353,7 +360,7 @@ task uploadBackups {
}

doLast {
def shortVersion = version.substring(0, version.indexOf("-MC"))
def shortVersion = getGhVersion().substring(1)
def backupUrl = "https://api.wurstclient.net/artifact-backups/ChestESP/${shortVersion}"

def connection = new URL(backupUrl).openConnection() as HttpURLConnection
Expand Down

0 comments on commit 7f53e18

Please sign in to comment.