Skip to content

Commit

Permalink
Add note that bumping the readme version only happens for minor version
Browse files Browse the repository at this point in the history
  • Loading branch information
passsy committed Dec 19, 2023
1 parent 2e158ac commit 4a47b16
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions wiresdk_sidekick/lib/wiresdk_sidekick.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,19 @@ Future<void> bumpReadme(
) async {
final readme = package.root.file('README.md');
final content = readme.readAsStringSync();
final next = '${newVersion.major}.${newVersion.minor}.0';
final minorRelease = '${newVersion.major}.${newVersion.minor}.0';
if (Version.parse(minorRelease) <= newVersion) {
print("Not updating version in README.md, "
"because it's not a major or minor version bump");
return;
}

final versionRegex = RegExp(r'wiredash:\s*\^(.+)');
final update = content.replaceAllMapped(
versionRegex,
(match) => match[0]!.replaceFirst(match[1]!, next),
(match) {
return match[0]!.replaceFirst(match[1]!, minorRelease);
},
);
readme.writeAsStringSync(update);
}

0 comments on commit 4a47b16

Please sign in to comment.