Skip to content

Commit c812261

Browse files
committed
prepare release workflow
1 parent cffadac commit c812261

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.github/workflows/bump_version.py

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
from pathlib import Path
3+
import subprocess
34
import sys
45
import re
56

@@ -12,6 +13,7 @@
1213

1314
class Updater:
1415
component: str = "patch"
16+
new_version: str = "0.0.0"
1517

1618
@staticmethod
1719
def replace(match: re.Match[str]) -> str:
@@ -35,6 +37,7 @@ def replace(match: re.Match[str]) -> str:
3537
rc_str = f"-rc{ver[3]}" if ver[3] > 0 else ""
3638
new_version += rc_str
3739
print("new version:", new_version)
40+
Updater.new_version = new_version
3841
return VER_REPLACE % (tuple(ver[:3]) + (rc_str,))
3942

4043

@@ -47,6 +50,28 @@ def main():
4750
doc = VER_PATTERN.sub(Updater.replace, doc)
4851
cargo_path.write_text(doc, encoding="utf-8", newline="\n")
4952
print("Updated version in Cargo.toml")
53+
subprocess.run(
54+
[
55+
"yarn",
56+
"version",
57+
"--new-version",
58+
Updater.new_version,
59+
"--no-git-tag-version",
60+
],
61+
cwd="node-binding",
62+
check=True,
63+
)
64+
subprocess.run(["napi", "prepublish"], cwd="node-binding", check=True)
65+
print("Updated version in node-binding/**package.json")
66+
subprocess.run(["git", "add", "--all"], check=True)
67+
tag = "v" + Updater.new_version
68+
subprocess.run(["git", "commit", "-m", f"bump version to {tag}"], check=True)
69+
subprocess.run(["git", "push"], check=True)
70+
print("Pushed commit to 'bump version to", tag, "'")
71+
subprocess.run(["git", "tag", tag], check=True)
72+
print("Created tag", tag)
73+
print("Use 'git push --tag", tag, "' to publish a release")
74+
5075
return 0
5176

5277

node-binding/package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,10 @@
3535
"bugs": {
3636
"url": "https://github.com/cpp-linter/cpp_linter_rs/issues"
3737
},
38-
"homepage": "https://github.com/cpp-linter/cpp_linter_rs#readme"
39-
}
38+
"homepage": "https://github.com/cpp-linter/cpp_linter_rs#readme",
39+
"optionalDependencies": {
40+
"@cpp-linter/cpp-linter-win32-x64-msvc": "2.0.0-rc1",
41+
"@cpp-linter/cpp-linter-darwin-x64": "2.0.0-rc1",
42+
"@cpp-linter/cpp-linter-linux-x64-gnu": "2.0.0-rc1"
43+
}
44+
}

0 commit comments

Comments
 (0)