Skip to content

Commit

Permalink
Fix deployment of macOS (flavor support) (#1203)
Browse files Browse the repository at this point in the history
Current main fails because of:

```
The Xcode project defines schemes: dev, Flutter Assemble, prod
You must specify a --flavor option to select one of the available schemes.
:

The Xcode project defines schemes: dev, Flutter Assemble, prod
You must specify a --flavor option to select one of the available schemes.
```

The PR fixes the deployment.
  • Loading branch information
nilsreichardt authored Dec 26, 2023
1 parent 60b1a95 commit 072950e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tools/sz_repo_cli/lib/src/commands/src/deploy_macos_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ final _macOsStageToTracks = {
'alpha': const TestFlightTrack('alpha'),
};

/// The different flavors of the macOS app that support deployment.
final _macOsFlavors = [
'prod',
'dev',
];

/// [DeployMacOsCommand] provides functionality for deploying the Sharezone macOS
/// app to the App Store or TestFlight.
///
Expand Down Expand Up @@ -57,6 +63,12 @@ class DeployMacOsCommand extends CommandBase {
'The deployment stage to deploy to. The "stable" stage is used for App Store releases, the "alpha" stage is used for TestFlight releases. The value will be forwarded to the "sz build" command.',
defaultsTo: 'stable',
);
argParser.addOption(
flavorOptionName,
allowed: _macOsFlavors,
help: 'The flavor to build for. Only the "prod" flavor is supported.',
defaultsTo: 'prod',
);

addAppStoreConnectKeyIdOption(argParser);
addAppStoreConnectIssuerIdOption(argParser);
Expand All @@ -65,6 +77,8 @@ class DeployMacOsCommand extends CommandBase {
addWhatsNewOption(argParser);
}

static const flavorOptionName = 'flavor';

List<String> get _macOsStages => _macOsStageToTracks.keys.toList();

@override
Expand Down Expand Up @@ -142,6 +156,7 @@ class DeployMacOsCommand extends CommandBase {
Future<void> _buildApp(ProcessRunner processRunner,
{required int buildNumber}) async {
try {
final flavor = argResults![flavorOptionName] as String;
final stage = argResults![releaseStageOptionName] as String;
await processRunner.run(
[
Expand All @@ -151,6 +166,8 @@ class DeployMacOsCommand extends CommandBase {
'sz_repo_cli',
'build',
'macos',
'--flavor',
flavor,
'--stage',
stage,
'--build-number',
Expand Down

0 comments on commit 072950e

Please sign in to comment.