Skip to content

appswithlove/updraft-plugin-android

Repository files navigation

updraft-plugin 🚀

Maven Central

This is a gradle plugin for automated upload to updraft.

Instructions

In order to use the plugin follow those steps:

Preconditions:

  • Uses Java 11

1.Add the code below to you build.gradle file in the project root folder.

buildscript {
  repositories {
    // ...
    mavenCentral()
  }

  dependencies {
    // ...
    classpath 'com.appswithlove.updraft:updraft:2.3.0'
  }
}

or

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

2.Apply the plugin in app/build.gradle

    id 'com.appswithlove.updraft'

or

  id("com.appswithlove.updraft")

3.Configure URLs for your build variants

Add one or more urls entries inside your updraft configuration block. Each entry maps a build variant name (e.g., StagingRelease, ProdRelease) to one or more upload URLs.

To get the correct URL, open your Updraft App, copy the https:// part from the curl command (e.g. https://app.getupdraft.com/api/app_upload/.../.../), and paste it as shown below.

This tells the plugin where to upload your APK/AAB files for each build variant.

updraft {
    urls = [
        "StagingRelease": ["your/staging/url/"],
        "ProdRelease": ["your/prod/url/", "your/prod2/url/"]
    ]
}

or

updraft {
    urls = mapOf(
        "ProdRelease" to listOf("your/prod/url"),
        "StagingRelease" to listOf("your/url"),
    )
}

4.Done!

Usage

After installing the plugin, you should be able to find the Gradle Updraft tasks in Android Studio. The naming is always updraft + buildVariant (updraftBundle + buildVariant for App Bundles). The appropriate url will be chosen as destination. There is 1 task for every available buildVariant. "Gradle Project" Window -> Tasks -> Other -> updraft... (e.g. updraftRelease or updraftBundleRelease) In order to use them, make sure that you build the project before.

Otherwise, you can call the gradle tasks via command:

./gradlew updraftRelease // for APK
./gradlew updraftBundleRelease // for AAB

Or combined with clean + assemble:

./gradlew clean assembleRelease updraftRelease // for APK
./gradlew clean bundleRelease updraftBundleRelease // for AAB

Breaking Change

When Upgrading from Version 2.1.7 to 2.2.0, the plugin id must be changed from updraft to com.appswithlove.updraft

Release Notes

In order to upload release notes, there are 3 options:

  1. Last commit message (default). If you don't specify anything, the release notes will contain the content of the latest commit message.
  2. Add parameter releaseNotes to updraft tag and pass in a string or function that generates a string.
  3. Add your release notes to /src/main/updraft/release-notes.txt or /src/someFlavor/updraft/release-notes.txt. If this file exists in either main or your current flavour, it will be taken instead of the git commit message.
  4. You can also pass releaseNotes as a runtime parameter ./gradlew updraftRelease -PreleaseNotes="your release notes"

Debug

In order to debug the plugin, clean -> jar -> publishJarPublicationToMavenLocal and connect your android App to the mavenLocal-version of the android plugin by adding the following snipped to your root-folder build.gradle

buildscript {
	repositories {
		mavenLocal()
		// ...
	}
	dependencies {
	    classpath 'com.appswithlove.updraft:updraft:2.3.0'
	    // ...
	}
}

After that, call the following script in the terminal of your android app (replace FLAVOUR)

./gradlew updraftRelease -Dorg.gradle.debug=true --no-daemon

Lastly, open the Updraft Plugin in Android Studio, add an Remote build configuration with Attach to remote JVM and run the configuration on debug. Now the gradlew call you triggered before will start running and will hit the break points in the plugin. :)

Don't forget to republish the plugin-jar when doing changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages