Skip to content

Commit 18c60c4

Browse files
authored
ci: bump go.mod file (#176)
1 parent 8c5702b commit 18c60c4

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.versionrc.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,30 @@ const versionFileUpdater = {
1616
const [major, minor, patch] = [splitted[0], splitted[1], splitted[2]];
1717

1818
return contents
19-
.replace(this.MAJOR_REGEX.exec(contents)[0], `versionMajor = ${major}`)
20-
.replace(this.MINOR_REGEX.exec(contents)[0], `versionMinor = ${minor}`)
21-
.replace(this.PATCH_REGEX.exec(contents)[0], `versionPatch = ${patch}`);
19+
.replace(this.MAJOR_REGEX, `versionMajor = ${major}`)
20+
.replace(this.MINOR_REGEX, `versionMinor = ${minor}`)
21+
.replace(this.PATCH_REGEX, `versionPatch = ${patch}`);
22+
}
23+
}
24+
25+
const moduleVersionUpdater = {
26+
GO_MOD_REGEX: /stream-chat-go\/v(\d+)/g,
27+
28+
readVersion: function (contents) {
29+
return this.GO_MOD_REGEX.exec(contents)[1];
30+
},
31+
32+
writeVersion: function (contents, version) {
33+
const major = version.split('.')[0];
34+
35+
return contents.replace(this.GO_MOD_REGEX, `stream-chat-go/v${major}`);
2236
}
2337
}
2438

2539
module.exports = {
26-
bumpFiles: [{ filename: './version.go', updater: versionFileUpdater }],
40+
bumpFiles: [
41+
{ filename: './version.go', updater: versionFileUpdater },
42+
{ filename: './go.mod', updater: moduleVersionUpdater },
43+
{ filename: './README.md', updater: moduleVersionUpdater },
44+
],
2745
}

0 commit comments

Comments
 (0)