From cd022786f48d8f632525f12cce05e8addf50f4e5 Mon Sep 17 00:00:00 2001 From: Mohammed CHAHBOUN <69054810+M97Chahboun@users.noreply.github.com> Date: Sun, 16 Jun 2024 02:06:56 +0100 Subject: [PATCH] Support set track for playstore deployment (#185) * Support specific deployment track for android build * Removed default track * Check track implementation * Added logs for check track * Added logs for check track value * Added track to commands * Used track from PublishPlayStoreConfig * removed unused oimport and format code * Improved track usage * minor imrpovement --- .../playstore/app_package_publisher_playstore.dart | 9 +++++++++ .../publishers/playstore/publish_playstore_config.dart | 3 +++ packages/flutter_distributor/bin/command_publish.dart | 2 ++ website/src/content/docs/publishers/playstore.md | 2 ++ website/src/content/docs/zh-hans/publishers/playstore.md | 2 ++ 5 files changed, 18 insertions(+) diff --git a/packages/flutter_app_publisher/lib/src/publishers/playstore/app_package_publisher_playstore.dart b/packages/flutter_app_publisher/lib/src/publishers/playstore/app_package_publisher_playstore.dart index b23e8f06..ab099de8 100644 --- a/packages/flutter_app_publisher/lib/src/publishers/playstore/app_package_publisher_playstore.dart +++ b/packages/flutter_app_publisher/lib/src/publishers/playstore/app_package_publisher_playstore.dart @@ -56,6 +56,15 @@ class AppPackagePublisherPlayStore extends AppPackagePublisher { appEdit.id!, ); + if (publishConfig.track != null) { + await publisherApi.edits.tracks.update( + Track(track: publishConfig.track), + publishConfig.packageName, + appEdit.id!, + publishConfig.track!, + ); + } + return PublishResult( url: '', ); diff --git a/packages/flutter_app_publisher/lib/src/publishers/playstore/publish_playstore_config.dart b/packages/flutter_app_publisher/lib/src/publishers/playstore/publish_playstore_config.dart index 71779feb..7dcef38b 100644 --- a/packages/flutter_app_publisher/lib/src/publishers/playstore/publish_playstore_config.dart +++ b/packages/flutter_app_publisher/lib/src/publishers/playstore/publish_playstore_config.dart @@ -8,6 +8,7 @@ class PublishPlayStoreConfig extends PublishConfig { PublishPlayStoreConfig({ required this.credentialsFile, required this.packageName, + required this.track, }); factory PublishPlayStoreConfig.parse( @@ -25,9 +26,11 @@ class PublishPlayStoreConfig extends PublishConfig { PublishPlayStoreConfig publishConfig = PublishPlayStoreConfig( credentialsFile: credentialsFile!, packageName: publishArguments?['package-name'], + track: publishArguments?['track'], ); return publishConfig; } final String credentialsFile; final String packageName; + final String? track; } diff --git a/packages/flutter_distributor/bin/command_publish.dart b/packages/flutter_distributor/bin/command_publish.dart index 30b2a28c..413fb6de 100644 --- a/packages/flutter_distributor/bin/command_publish.dart +++ b/packages/flutter_distributor/bin/command_publish.dart @@ -141,6 +141,7 @@ class CommandPublish extends Command { // PlayStore argParser.addSeparator('playstore'); argParser.addOption('playstore-package-name', valueHelp: ''); + argParser.addOption('playstore-track', valueHelp: ''); // Qiniu argParser.addSeparator('qiniu'); @@ -207,6 +208,7 @@ class CommandPublish extends Command { 'github-repo-name': argResults?['github-repo-name'], 'github-release-title': argResults?['github-release-title'], 'playstore-package-name': argResults?['playstore-package-name'], + 'playstore-track': argResults?['playstore-track'], 'qiniu-bucket': argResults?['qiniu-bucket'], 'qiniu-bucket-domain': argResults?['qiniu-bucket-domain'], 'qiniu-savekey-prefix': argResults?['qiniu-savekey-prefix'], diff --git a/website/src/content/docs/publishers/playstore.md b/website/src/content/docs/publishers/playstore.md index ea10a9f0..1a72a9d3 100644 --- a/website/src/content/docs/publishers/playstore.md +++ b/website/src/content/docs/publishers/playstore.md @@ -22,6 +22,7 @@ flutter_distributor publish \ --path dist/1.0.0+1/hello_world-1.0.0+1-android.aab \ --targets playstore \ --playstore-package-name 'org.leanflutter.examples.hello_world' / + --playstore-track alpha ``` ### Configure `distribute_options.yaml` @@ -42,6 +43,7 @@ releases: target: playstore args: package-name: org.leanflutter.examples.hello_world + track: alpha ``` Run: diff --git a/website/src/content/docs/zh-hans/publishers/playstore.md b/website/src/content/docs/zh-hans/publishers/playstore.md index 02bc89e5..ca3157ba 100644 --- a/website/src/content/docs/zh-hans/publishers/playstore.md +++ b/website/src/content/docs/zh-hans/publishers/playstore.md @@ -22,6 +22,7 @@ flutter_distributor publish \ --path dist/1.0.0+1/hello_world-1.0.0+1-android.aab \ --targets playstore \ --playstore-package-name 'org.leanflutter.examples.hello_world' / + --playstore-track alpha ``` ### 配置 `distribute_options.yaml` @@ -42,6 +43,7 @@ releases: target: playstore args: package-name: org.leanflutter.examples.hello_world + track: alpha ``` 运行: