From 246fac97980081a32d2cb7ce8e507aea86cf9681 Mon Sep 17 00:00:00 2001 From: leedongmyung Date: Mon, 26 May 2025 16:06:02 +0900 Subject: [PATCH] distribute pollishing --- lib/oto/commands/build/testflight_ios.dart | 33 ++++++++++++++-------- lib/oto/data/command_data.dart | 1 + lib/oto/data/command_data.g.dart | 4 ++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/oto/commands/build/testflight_ios.dart b/lib/oto/commands/build/testflight_ios.dart index cfc3d14..ed68f54 100644 --- a/lib/oto/commands/build/testflight_ios.dart +++ b/lib/oto/commands/build/testflight_ios.dart @@ -35,18 +35,20 @@ class TestflightStatusCheck extends Command { Future execute(DataCommand command) async { var data = DataTestflightStatusCheck.fromJson(getParam(command)); - var fastFile = await BuildiOS.initializeFastlane(data.workspace!, data.apiKeyPath, data.appID); + var fastFile = await BuildiOS.initializeFastlane( + data.workspace!, data.apiKeyPath, data.appID); var fastlaneContent = fastFile.readAsStringSync(); - fastlaneContent = fastlaneContent.replaceFirst('[TARGET_VERSION]', data.version) - .replaceFirst('[TARGET_BUILD_NUMBER]', data.buildNumber); + fastlaneContent = fastlaneContent + .replaceFirst('[TARGET_VERSION]', data.version) + .replaceFirst('[TARGET_BUILD_NUMBER]', data.buildNumber); fastFile.writeAsStringSync(fastlaneContent, flush: true); var messageInReview = 'Review in progress.'; var messageComplete = 'Your review has been completed 🎉'; const result = '[RESULT]: '; var isProcessing = true; - while(isProcessing) { + while (isProcessing) { var shell = StringBuffer(); shell.write('cd ${data.workspace}/fastlane'); shell.write(' && fastlane testflight_status'); @@ -57,14 +59,14 @@ class TestflightStatusCheck extends Command { if (item.contains(result)) { var json = jsonDecode(item.substring(item.indexOf(result) + result.length)); - if(json['state'] == 'VALID') { + if (json['state'] == 'VALID') { isProcessing = false; } break; } } - if(isProcessing) { + if (isProcessing) { print(messageInReview); messageInReview += '.'; } else { @@ -81,19 +83,26 @@ class TestflightDistribute extends Command { @override Future execute(DataCommand command) async { var data = DataTestflightDistribute.fromJson(getParam(command)); - - var testers = data.testers != null && data.testers!.isNotEmpty ? ' --groups "${data.testers}"' : ''; - var message = data.message != null && data.message!.isNotEmpty ? ' --changelog "${data.message}"' : ''; + + var testers = data.testers != null && data.testers!.isNotEmpty + ? ' --groups "${data.testers}"' + : ''; + var message = data.message != null && data.message!.isNotEmpty + ? ' --changelog "${data.message}"' + : ''; + var buildNumber = data.buildNumber != null && data.buildNumber!.isNotEmpty + ? ' --build_number ${data.buildNumber}' + : ''; var platform = data.platform ?? 'ios'; print('Distribute is processing...'); var shell = StringBuffer(); shell.write('cd ${data.workspace}/fastlane'); shell.write( - ' && fastlane pilot distribute --api_key_path ${data.apiKeyPath} --app_identifier ${data.appID}$testers$message --app-platform $platform'); + ' && fastlane pilot distribute --api_key_path ${data.apiKeyPath} --app_identifier ${data.appID}$testers$message$buildNumber --app-platform $platform'); - var process = await ProcessExecutor.start(shell, - logHandler: Application.logWithType); + var process = + await ProcessExecutor.start(shell, logHandler: Application.logWithType); return await completeProcess(process, command, passExitCodes: [1]); } diff --git a/lib/oto/data/command_data.dart b/lib/oto/data/command_data.dart index 97437ef..fe04db2 100644 --- a/lib/oto/data/command_data.dart +++ b/lib/oto/data/command_data.dart @@ -374,6 +374,7 @@ class DataTestflightDistribute extends DataParam { late String? message; late String? testers; late String? platform; + late String? buildNumber; factory DataTestflightDistribute.fromJson(Map json) => _$DataTestflightDistributeFromJson(json); diff --git a/lib/oto/data/command_data.g.dart b/lib/oto/data/command_data.g.dart index 74f32af..55d666d 100644 --- a/lib/oto/data/command_data.g.dart +++ b/lib/oto/data/command_data.g.dart @@ -668,7 +668,8 @@ DataTestflightDistribute _$DataTestflightDistributeFromJson( ..appID = json['appID'] as String ..message = json['message'] as String? ..testers = json['testers'] as String? - ..platform = json['platform'] as String?; + ..platform = json['platform'] as String? + ..buildNumber = json['buildNumber'] as String?; Map _$DataTestflightDistributeToJson( DataTestflightDistribute instance) => @@ -683,6 +684,7 @@ Map _$DataTestflightDistributeToJson( 'message': instance.message, 'testers': instance.testers, 'platform': instance.platform, + 'buildNumber': instance.buildNumber, }; DataPublishiOS _$DataPublishiOSFromJson(Map json) =>