/rustore-publish-gradle-plugin

RuStore Gradle Plugin that allows you to publish the android APK build file to the RuStore.

Primary LanguageKotlinApache License 2.0Apache-2.0

RuStore Publishing

Version Version License

The plugin use Rustore API to publish Android *.apk build file to the RuStore.

Table of contents

Features

The following features are available:

  • ✅ Publish APK build file in RuStore
  • ✅ Submit the build on all users after getting store approve
  • ✅ Update Release Notes for publishing build (Release Notes)
  • ✅ Separated settings for different configurations build types and flavors
  • ✅ Support of Gradle Portal and Gradle DSL
  • ✅ Support of Gradle 8.+
  • ✅ Support of Configuration Cache

The following features are missing:

  • 🚸 Change App Store Information: description, app icon, screenshots and etc.
  • 🚸 Support of AppBundle
  • 🚸 Publish the build on a part of users (Release Phases)

The following features are not available on Rustore API side yet:

  • ⛔ Rollout Holding

!!! MORE INFORMATION COMING SOON !!!

Compatibility

The Android Gradle Plugin often changes the Variant API, so a different version of AGP corresponds to a specific version of the current plugin

AGP Plugin
7.+ 0.2.2
8.+ 0.3.1

Adding the plugin to your project

in application module ./app/build.gradle

Using the Gradle plugin DSL

plugins {
    id("com.android.application")
    id("ru.cian.rustore-publish-gradle-plugin")
}

Using the apply method

buildscript {
    repositories {
        gradlePluginPortal()
    }

    dependencies {
        classpath "ru.cian.rustore-plugin:plugin:<VERSION>"
    }
}

apply plugin: 'com.android.application'
apply plugin: 'ru.cian.rustore-publish-gradle-plugin'

Configuring Plugin

Kotlin
rustorePublish {
  instances {
    create("release") {
      /**
       * Path to json file with RuStore credentials params (`company_id` and `client_secret`).
       * How to get credentials see [[RU] Rustore API Getting Started](https://help.rustore.ru/rustore/for_developers/work_with_RuStore_API/authorization_rustore_api_1).
       * Plugin credential json example:
       * {
       *   "company_id": "<COMPANY_ID>",
       *   "client_secret": "<CLIENT_SECRET>"
       * }
       *
       * Type: String (Optional)
       * Default value: `null` (but plugin wait that you provide credentials by CLI params)
       * CLI: `--credentialsPath`
       */
      credentialsPath = "$rootDir/rustore-credentials-release.json"

      /**
       * Path to build file if you would like to change default path. "null" means use standard path for "apk" and "aab" files.
       * Type: String (Optional)
       * Default value: `null`
       * CLI: `--buildFile`
       */
      buildFile = "$rootDir/app/build/outputs/apk/release/app-release.apk"

      /**
       * Release Notes settings. For mote info see ReleaseNote param desc.
       * Type: List<ReleaseNote> (Optional)
       * Default value: `null`
       * CLI: (see ReleaseNotes param desc.)
       */
      releaseNotes = listOf(
        /**
         * Release Note list item.
         */
        ru.cian.rustore.publish.ReleaseNote(
          /**
           * Description: Support only `ru-RU` lang.
           * Type: String (Required)
           * Default value: `null`
           * CLI: (See `--releaseNotes` desc.)
           */
          lang = "ru-RU",

          /**
           * Absolutely path to file with Release Notes for current `lang`. Release notes text must be less or equals to 500 sign.
           * Type: String (Required)
           * Default value: `null`
           * CLI: (See `--releaseNotes` desc.)
           */
          filePath = "$projectDir/release-notes-ru.txt"
        ),
      )
    }
    create("debug") {
      ...
    }
  }
}
Groovy
rustorePublish {
    instances {
        release {
            credentialsPath = "$rootDir/rustore-credentials-release.json"
            buildFile = "$rootDir/app/build/outputs/apk/release/app-release.apk"
            releaseNotes = [
                new ru.cian.rustore.publish.ReleaseNote(
                    "ru-RU",
                    "$projectDir/release-notes-ru.txt"
                ),
            ]
        }
        debug {
            ...
        }
    }
}

the same by CLI

./gradlew assembleRelease publishRustoreRelease \
    --credentialsPath="/sample-kotlin/rustore-credentials.json" \
    --buildFile="/sample-kotlin/app/build/outputs/apk/release/app-release.apk" \
    --releaseNotes="ru_RU:/home/<USERNAME>/str/project/release_notes_ru.txt"

CLI params are more priority than Plugin configuration params.

Also the plugin support different buildType and flavors. So for demo and full flavors and release buildType just change instances like that:

rustorePublish {
    instances {
      create("release") {
          credentialsPath = "$rootDir/rustore-credentials-release.json"
          ...
      }
      create("demoRelease") {
          credentialsPath = "$rootDir/rustore-credentials-demo-release.json"
          ...
      }
      create("fullRelease") {
          credentialsPath = "$rootDir/rustore-credentials-full-release.json"
          ...
      }
    }
}

Plugin usage

Gradle generate publishRustore* task for all buildType and flavor configurations

android {
    buildTypes {
        release {
            ...
        }
        debug {
            ...
        }
    }
}

Note! The plugin will publish already existed build file. Before uploading you should build it yourself. Be careful. Don't publish old build file.

./gradlew assembleRelease publishRustoreRelease

You can apply or override each plugin extension parameter dynamically by using CLI params.

Promotion

Also consider our Gradle Plugin for publishing to Huawei AppGallery

License

Copyright 2023 Aleksandr Mirko

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.