-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
.versionrc.js
61 lines (53 loc) · 1.6 KB
/
.versionrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const version_updater_regex = {
readVersion: function (contents) {
version_m = contents.match(this.regex);
if (!version_m)
throw new Error("Cannot parse version!");
return version_m[1];
},
writeVersion: function (contents, version) {
new_version = this.regex_repl.replace("$1", version);
return contents.replace(this.regex, new_version);
}
}
let version_updater_poetry = {...version_updater_regex};
version_updater_poetry.regex = /^version = \"([^\"]+)\"$/m;
version_updater_poetry.regex_repl = "version = \"$1\"";
// YYYY-MM-DD
let today = new Date().toISOString().substring(0, 10);
let version_updater_python = {...version_updater_regex};
version_updater_python.regex = /^__version__ = \"([^\"]+)\"\n__version_date__ = \"[^\"]+\"$/m;
version_updater_python.regex_repl = "__version__ = \"$1\"\n__version_date__ = \"" + today + "\"";
let version_updater_readme = {...version_updater_regex};
version_updater_readme.regex = /\d+\.\d+\.\d+/g;
version_updater_readme.regex_repl = "$1";
version_file = "gridplayer/version.py"
let packageFiles = [
{
filename: "pyproject.toml",
updater: version_updater_poetry,
}
]
let bumpFiles = packageFiles.concat([
{
filename: version_file,
updater: version_updater_python,
},
{
filename: "README.md",
updater: version_updater_readme,
}
])
module.exports = {
header: "",
commitAll: true,
sign: true,
packageFiles: packageFiles,
bumpFiles: bumpFiles,
skip: {
changelog: true
},
scripts: {
postbump: `poetry run python scripts/_helpers/kacl.py "${version_file}" CHANGELOG.md && git add CHANGELOG.md`
}
}