-
-
Save skyrylyuk/6510769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task uploadTf(dependsOn: assembleRelease) << { | |
def teamToken = '<TestFlight team token here>' | |
def apiToken = '<TestFlight api token here>' | |
def lists = '<TestFlight distribution lists here>' | |
def apk = file("build/apk/$project.name-release.apk") | |
def notes = new File(file('changelog.mdown')).getText("UTF-8") | |
def http = new HTTPBuilder('http://testflightapp.com') | |
println('Uploading build to TestFlight...') | |
http.request(POST, JSON) { req -> | |
uri.path = '/api/builds.json' | |
requestContentType = 'multipart/form-data' | |
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE) | |
entity.addPart('distribution_lists', new StringBody(lists)) | |
entity.addPart('team_token', new StringBody(teamToken)) | |
entity.addPart('api_token', new StringBody(apiToken)) | |
entity.addPart('notes', new StringBody(notes)) | |
entity.addPart('file', new FileBody(apk)) | |
req.setEntity(entity) | |
response.success = {resp, json -> | |
println("Upload successful!") | |
} | |
response.failure = {resp -> | |
println(resp) | |
throw new StopExecutionException("TestFlight upload failed! See server response above") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment