publish method

Future<int> publish()

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:

  1. Process and validate file arguments
  2. Display job configuration
  3. Execute publisher command with arguments
  4. Stream output and error logs
  5. 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;
}