Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build

on:
push:
branches: [ "main" ]
branches: [ "main", "release/2.x" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "release/2.x" ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
push:
branches: [ production ]
branches: [ production, release/2.x ]

jobs:
publish:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {

dependencies {
// ...
classpath 'com.appswithlove.updraft:updraft:2.3.0'
classpath 'com.appswithlove.updraft:updraft:2.3.1'
}
}
```
Expand All @@ -32,7 +32,7 @@ or

```kotlin
plugins {
id("com.appswithlove.updraft") version "2.3.0"
id("com.appswithlove.updraft") version "2.3.1"
}
```

Expand Down Expand Up @@ -114,7 +114,7 @@ buildscript {
// ...
}
dependencies {
classpath 'com.appswithlove.updraft:updraft:2.3.0'
classpath 'com.appswithlove.updraft:updraft:2.3.1'
// ...
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

GROUP=com.appswithlove.updraft
POM_ARTIFACT_ID=updraft
VERSION_NAME=2.3.0
VERSION_NAME=2.3.1

POM_NAME=updraft-plugin-android
POM_DESCRIPTION=This is a gradle Android plugin for automated uploads to Updraft
Expand Down
66 changes: 39 additions & 27 deletions lib/src/main/kotlin/com/appswithlove/updraft/UpdraftTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,38 +78,50 @@ abstract class UpdraftTask : DefaultTask() {
it.standardOutput = os
}

val execResponse = JsonSlurperClassic().parseText(os.toString())

if (execResponse is Map<*, *> && execResponse.isNotEmpty()) {
when {
execResponse["success"] == "ok" -> {
val publicUrl = execResponse["public_link"]
println("\n--------------------------------------")
println("Your App was successfully updrafted!")
if (publicUrl != null) println("Get it here -> $publicUrl")
println("--------------------------------------")
}

execResponse["detail"] == "Not found." -> {
throw GradleException("Could not updraft to the given url. Please recheck that.")
}

else -> {
throw GradleException(os.toString())
}
}
} else {
println(execResponse)
println("\n--------------------------------------")
println("Your App was successfully updrafted!")
println("--------------------------------------")
}
handleResponse(os.toString())
}
}
}

companion object {
private fun createCurlParam(text: String?, name: String): String {
internal fun handleResponse(response: String) {
val execResponse = JsonSlurperClassic().parseText(response)

if (execResponse is Map<*, *> && execResponse.isNotEmpty()) {
when {
execResponse["success"] == "ok" -> {
val publicUrl = execResponse["public_link"]
println("\n--------------------------------------")
println("Your App was successfully updrafted!")
if (publicUrl != null) println("Get it here -> $publicUrl")
println("--------------------------------------")
}

// App bundles (AAB) are processed asynchronously: Updraft accepts the upload and returns a task id
execResponse["task_id"] != null -> {
println("\n--------------------------------------")
println("Your App was uploaded to Updraft and is being processed.")
execResponse["task_upload_description"]?.let { println(it) }
println("--------------------------------------")
}

execResponse["detail"] == "Not found." -> {
throw GradleException("Could not updraft to the given url. Please recheck that.")
}

else -> {
throw GradleException(response)
}
}
} else {
println(execResponse)
println("\n--------------------------------------")
println("Your App was successfully updrafted!")
println("--------------------------------------")
}
}

internal fun createCurlParam(text: String?, name: String): String {
return if (text.isNullOrBlank()) "" else "-F $name=$text"
}
}
Expand Down
Loading