run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  final args = ensureArgResults();
  final currentVersion = await nextVersionCommand.getVersionFromPubspec();
  final currentVersionWithoutBuild =
      versionStringWithoutBuild(currentVersion);
  final tagId = await remoteTagIdCommand.getRemoteTagId(
    currentVersionWithoutBuild,
    'origin',
  );
  final commits = await changelogCommand.getCommitsFromId(
    tagId.isEmpty ? null : tagId,
  );
  final nextVersion = await nextVersionCommand.getNextVersionFromString(
    commits,
    currentVersion,
    incrementBuild: true,
    ensureMajor: args['ensure-major'] as bool,
  );
  if (nextVersion != currentVersion) {
    await _createRelease(
      commits: commits,
      nextVersion: nextVersion,
      writeSummary: args['write-summary'] as bool,
      updateYear: args['update-year'] as bool,
      noBuild: args['no-build'] as bool,
    );
  } else {
    printer.println('There are no releasable commits');
  }
}