Хочу заливать APK на сервер после сборки релиза. Сделал в gradle срипт, работает все нормально, но мне нужно заливать его не после каждой сборки, а только если выбрал в студии через меню Build -> Build bundles -> Build APK. 
Делаю так
gradle.buildFinished{
    def source = null
    android.applicationVariants.all { variant ->
        if ( (variant.name).equals("appRelease")) {
            println("Variant: " + variant.name +" "+variant.applicationId)
            variant.outputs.each { output ->
                source = output.outputFile
                if(file(source).exists()) {
                    println("Upload: " + source);
                    def sOutput = new ByteArrayOutputStream()
                    def eOutput = new ByteArrayOutputStream()
                    exec{
                        commandLine curl, "-F apk=@" + source, "htpps://host"
                        standardOutput = sOutput
                        errorOutput = eOutput
                    }
                    assert sOutput.toString().equals("ok") : "Upload APK fail: " + sOutput.toString();
                }
            }
        }
    }
}
Есть ли какое то свойство типа android.buildAPKFomMenu по которому можно будет определять как именно вызывалась сборка?
Ну или какой то может макрос сделать, чтобы по кнопке на сервер заливалось?

