Skip to content

Commit

Permalink
We are still pushing some builds, may as well add the update tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed May 12, 2020
1 parent 3a68c5a commit 739e63b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions build.gradle
@@ -1,3 +1,5 @@
import groovy.json.JsonOutput

plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
}
Expand Down Expand Up @@ -146,3 +148,35 @@ curseforge {
mainArtifact assembleMC1120
}
}

task updateVersionTracker {

onlyIf {

project.hasProperty('versionTrackerAPI')
}

doLast {
def body = [
'author' : "${project.findProperty('versionTrackerAuthor')}",
'projectName' : "crafttweaker",
'gameVersion' : "1.12.2",
'projectVersion': "${version}",
'homepage' : "${project.findProperty('versionTrackerHomepage')}",
'uid' : "${project.findProperty('versionTrackerKey')}"
]

// Opens a connection to the version tracker API and writes the payload JSON.
def req = new URL(project.findProperty('versionTrackerAPI')).openConnection()
req.setRequestMethod('POST')
req.setRequestProperty('Content-Type', 'application/json; charset=UTF-8')
req.setRequestProperty('User-Agent', "Crafttweaker Tracker Gradle")
req.setDoOutput(true)
req.getOutputStream().write(JsonOutput.toJson(body).getBytes("UTF-8"))

// We need to attempt a read in order to actually send the message.
println "VersionCheck Status code: ${req.getResponseCode()}"
println "VersionCheck Response: ${req.getInputStream().getText()}"
}

}

0 comments on commit 739e63b

Please sign in to comment.