addGitTag method

void addGitTag(
  1. Version? version, {
  2. required bool autoAnswer,
})

Implementation

void addGitTag(Version? version, {required bool autoAnswer}) {
  assert(_usingGit == true);
  final tagName = '$version';
  // Check if the tag already exists and offer to replace it if it does.
  if (tagExists(tagName)) {
    if (autoAnswer ||
        confirm(
            'The tag $tagName already exists. Do you want to replace it?')) {
      'git tag -d $tagName'.run;
      //     'git push origin :refs/tags/$tagName'.run;
      'git push --follow-tags'.run;
      print('');
    }
  }

  print('creating git tag');

  'git tag -a $tagName -m "released $tagName"'.run;
  print('pushing tag');
  'git push origin :refs/tags/$tagName'.run;
  'git push --follow-tags'.run;
}