diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f73789..e3fcca8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b01a426..98b94c3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Publish on: push: - branches: [ production ] + branches: [ production, release/2.x ] jobs: publish: diff --git a/README.md b/README.md index 30b2807..687359d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ buildscript { dependencies { // ... - classpath 'com.appswithlove.updraft:updraft:2.3.0' + classpath 'com.appswithlove.updraft:updraft:2.3.1' } } ``` @@ -32,7 +32,7 @@ or ```kotlin plugins { - id("com.appswithlove.updraft") version "2.3.0" + id("com.appswithlove.updraft") version "2.3.1" } ``` @@ -114,7 +114,7 @@ buildscript { // ... } dependencies { - classpath 'com.appswithlove.updraft:updraft:2.3.0' + classpath 'com.appswithlove.updraft:updraft:2.3.1' // ... } } diff --git a/gradle.properties b/gradle.properties index a2b2d8a..657fd68 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftTask.kt b/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftTask.kt index 4f91bc9..2b26b81 100644 --- a/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftTask.kt +++ b/lib/src/main/kotlin/com/appswithlove/updraft/UpdraftTask.kt @@ -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" } }