Skip to content

Commit

Permalink
Merge pull request #5 from Yakiyo/dev
Browse files Browse the repository at this point in the history
feat: update pre-release script
  • Loading branch information
Yakiyo committed Jun 14, 2023
2 parents ea8c19c + 66818f8 commit 0d4d17d
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tools/pre-release.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ void main() async {
.then((value) => "${value['package']['version']}");

// Check if the current version is already released or not
final git = await Process.run(
"git",
["tag", "-l"],
);
if (git.exitCode != 0) {
eprint("Command error. Returned exitcode ${git.exitCode}");
exitCode = git.exitCode;
return;
}
final gitTags = (git.stdout as String).split("\n");
gitTags.removeLast();
// final git = await Process.run(
// "git",
// ["tag", "-l"],
// );
// if (git.exitCode != 0) {
// eprint("Command error. Returned exitcode ${git.exitCode}");
// exitCode = git.exitCode;
// return;
// }
// final gitTags = (git.stdout as String).split("\n");
// gitTags.removeLast();

if (gitTags.contains("v$version")) {
eprint("A git tag for v$version already exists");
exitCode = 1;
return;
}
// if (gitTags.contains("v$version")) {
// eprint("A git tag for v$version already exists");
// exitCode = 1;
// return;
// }

// Ensure entry for current version is there on `CHANGELOG.md` in
// the format of `# {{ version }} (Unreleased)
final md = await File("CHANGELOG.md").readAsLines();

if (!md.contains("# $version (Unreleased)")) {
eprint("An entry for v$version does not exist in Changelog."
"It must be appended with an `(Unreleased)` in the title");
"It must be appended with an `(Unreleased)` suffix in the title");
}
final index = md.indexOf("# $version (Unreleased)");
md[index] = "# $version";
Expand Down

0 comments on commit 0d4d17d

Please sign in to comment.