Skip to content

Commit

Permalink
Support set track for playstore deployment (#185)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
M97Chahboun authored Jun 16, 2024
1 parent bb1bba8 commit cd02278
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class PublishPlayStoreConfig extends PublishConfig {
PublishPlayStoreConfig({
required this.credentialsFile,
required this.packageName,
required this.track,
});

factory PublishPlayStoreConfig.parse(
Expand All @@ -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;
}
2 changes: 2 additions & 0 deletions packages/flutter_distributor/bin/command_publish.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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'],
Expand Down
2 changes: 2 additions & 0 deletions website/src/content/docs/publishers/playstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -42,6 +43,7 @@ releases:
target: playstore
args:
package-name: org.leanflutter.examples.hello_world
track: alpha
```
Run:
Expand Down
2 changes: 2 additions & 0 deletions website/src/content/docs/zh-hans/publishers/playstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -42,6 +43,7 @@ releases:
target: playstore
args:
package-name: org.leanflutter.examples.hello_world
track: alpha
```
运行:
Expand Down

0 comments on commit cd02278

Please sign in to comment.