upload method
Implementation
@override
Future upload(String root) async {
final ipaPath = join(root, 'build', 'ios', 'ipa', 'meta_winner_app.ipa');
final channel = 'AppStore';
final buildName = environment.buildName;
final buildNumber = environment.buildNumber.toString();
final copyDir = Directory(join(root, 'ignore_dir', 'ios', 'ipa'));
if (!await copyDir.exists()) {
await copyDir.create(recursive: true);
}
final copyFilePath =
join(copyDir.path, '${channel}_${buildName}_$buildNumber.ipa');
await File(ipaPath).copy(copyFilePath);
if (!environment.upload) {
return;
}
if (!await File(ipaPath).exists()) {
logger.log('$ipaPath路径不存在!', status: LogStatus.error);
exit(2);
}
final result = await runCommand(environment.iosDir,
'fastlane upload_testflight ipa:$ipaPath changelog:\'$log\'')
.then((value) => value.first);
if (result.exitCode != 0) {
logger.log('上传失败!', status: LogStatus.error);
exit(result.exitCode);
}
}