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:
commit
70f01fa691
5 changed files with 81 additions and 71 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue