1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 16:07:12 -07:00

Merge branch 'master' of github.com:cbeust/kobalt

This commit is contained in:
Marcus Fihlon 2017-11-06 19:51:32 +01:00
commit 70f01fa691
No known key found for this signature in database
GPG key ID: C6B7F469EE363E1F
5 changed files with 81 additions and 71 deletions

View file

@ -86,12 +86,12 @@ class GithubApi2 @Inject constructor(
.execute()
val code = response.code()
if (code != Http.CREATED) {
val error = Gson().fromJson(response.errorBody().string(), RetrofitError::class.java)
val error = Gson().fromJson(response.errorBody()?.string(), RetrofitError::class.java)
throw KobaltException("Couldn't upload release, ${error.message}: " + error.errors[0].code)
} else {
val body = response.body()
uploadAsset(accessToken, body.uploadUrl!!, Http.TypedFile("application/zip", zipFile), tagName)
uploadAsset(accessToken, body?.uploadUrl!!, Http.TypedFile("application/zip", zipFile), tagName)
.toBlocking()
.forEach { action ->
kobaltLog(1, "\n${zipFile.name} successfully uploaded")
@ -138,8 +138,8 @@ class GithubApi2 @Inject constructor(
val releases = ex.body()
if (releases != null) {
releases.firstOrNull()?.let {
try {
result = listOf(it.name, it.tagName).filterNotNull().first { !it.isBlank() }
result = try {
listOf(it.name, it.tagName).filterNotNull().first { !it.isBlank() }
} catch(ex: NoSuchElementException) {
throw KobaltException("Couldn't find the latest release")
}