uploadAppToAppleStore method
Implementation
Future<void> uploadAppToAppleStore(
File buildFile, {
required String apiKeyId,
required String apiIssuer,
String? apiKey,
}) async {
var shell = _shell;
if (apiKey != null) {
if (apiKey.startsWith('-----BEGIN PRIVATE KEY-----') &&
apiKey.endsWith('-----END PRIVATE KEY-----')) {
final privateKeysDir = Directory('./private_keys');
if (!await privateKeysDir.exists()) await privateKeysDir.create();
final privateKeyFile = File('${privateKeysDir.path}/AuthKey_$apiKeyId.p8');
await privateKeyFile.writeAsString(apiKey);
} else {
shell = _shell.cloneWithOptions(_shell.options.clone(
shellEnvironment: ShellEnvironment.fromJson({
..._shell.options.environment,
'API_PRIVATE_KEYS_DIR': apiKey,
}),
));
}
}
await shell.singleRun('xcrun altool --upload-app '
'--type ios '
'-f ${buildFile.path} '
'--apiKey $apiKeyId '
'--apiIssuer $apiIssuer');
}