Skip to content

Commit a81cd73

Browse files
committed
Properly handle dev changelogs in bump-version-* tasks
Previously this wouldn't update -dev changelogs if we were bumping a more major version than the -dev version bumped.
1 parent 7f54226 commit a81cd73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tool/grind/bump_version.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ final _pubspecVersionRegExp = RegExp(r'^version: (.*)$', multiLine: true);
1717
/// A regular expression that matches a Sass dependency version in a pubspec.
1818
final _sassVersionRegExp = RegExp(r'^( +)sass: (\d.*)$', multiLine: true);
1919

20+
/// A regular expression that matches a CHANGELOG header for a dev version
21+
final _changelogDevHeaderRegExp = RegExp(r'^## .*-dev$', multiLine: true);
22+
2023
/// Adds grinder tasks for bumping package versions.
2124
void addBumpVersionTasks() {
2225
for (var patch in [false, true]) {
@@ -65,9 +68,9 @@ void _bumpVersion(bool patch, bool dev) {
6568
void addChangelogEntry(String dir, Version version) {
6669
var path = p.join(dir, "CHANGELOG.md");
6770
var text = File(path).readAsStringSync();
68-
if (!dev && text.startsWith("## $version-dev\n")) {
71+
if (!dev && text.startsWith(_changelogDevHeaderRegExp)) {
6972
File(path).writeAsStringSync(
70-
text.replaceFirst("## $version-dev\n", "## $version\n"),
73+
text.replaceFirst(_changelogDevHeaderRegExp, "## $version"),
7174
);
7275
} else if (text.startsWith("## $version\n")) {
7376
return;

0 commit comments

Comments
 (0)