createRelease function

void createRelease({
  1. required String username,
  2. required String apiToken,
  3. required String owner,
  4. required String repository,
})

Implementation

void createRelease(
    {required String username,
    required String apiToken,
    required String owner,
    required String repository}) {
  final sgh = SimpleGitHub(
      username: username,
      apiToken: apiToken,
      owner: owner,
      repository: repository)
    ..auth();

  final pubspecPath = findPubSpec(startingDir: pwd);

  if (pubspecPath == null) {
    print('Unable to find pubspec.yaml, run ${DartScript.self.exeName} '
        'from the main '
        "package's root directory.");
    exit(1);
  }

  final pubspec = PubSpec.fromFile(pubspecPath);
  final version = pubspec.version.toString();
  final tagName = version;

  print('Creating release for $tagName');
  _createRelease(sgh: sgh, pubspec: pubspec, tagName: tagName);

  updateLatestTag(sgh: sgh, pubspec: pubspec);

  sgh.dispose();
}