upmc-enterprises / gradle-slack-uploader-plugin

Uploads artifacts from a Gradle build as a file to a Slack channel

Home Page:https://oliverspryn.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple buildtypes & flavors

MHKalantarian opened this issue · comments

I want to run upload after each variant apk sign but I cant seem to figure it out. Can you help?
This is the code I wrote but its not executing the uploadFileToSlack

applicationVariants.all { variant ->
    variant.outputs.all {
        def appName = "FOOBAR"
        def flavorName = variant.baseName.split("-")[0]
        def buildType = variant.baseName.split("-")[1]
        outputFileName = "${appName}-${flavorName}-${buildType}-v${appVersionName}-c${appVersionCode}.apk"
    }
    variant.assemble.doLast {
        delete "${rootDir}/app/${flavorName}/${buildType}/output-metadata.json"
        uploadFileToSlack {
            comment "Version ${appVersionName}"
            channels "application_release"
            filePath "app/${flavorName}/${buildType}/${appName}-${flavorName}-${buildType}-v${appVersionName}-c${appVersionCode}.apk"
            token "slack-token"
        }
    }
}