publish method
Initiates the application publishing process.
Executes the complete publishing workflow including file processing, validation, and upload to the target platform. Provides detailed logging throughout the process for debugging and monitoring.
Returns the exit code of the publishing process:
0- Success- Non-zero - Error occurred during publishing
Process steps:
- Process and validate file arguments
- Display job configuration
- Execute publisher command with arguments
- Stream output and error logs
- Return process exit code
Implementation
Future<int> publish() async {
await processFilesArgs();
await printJob();
final arguments = await this.arguments;
logger.logDebug.call(
"Starting upload with `$publisher ${(arguments).join(" ")}`",
);
// Start the publisher process with arguments
final process = await Process.start(
publisher,
arguments,
runInShell: true,
includeParentEnvironment: true,
);
// Stream stdout and stderr with appropriate logging levels
process.stdout.transform(utf8.decoder).listen(logger.logDebug);
process.stderr.transform(utf8.decoder).listen(logger.logErrorVerbose);
return await process.exitCode;
}