Skip to content

Commit 61bca1f

Browse files
committed
Update release workflow and version bump script for flexible tagging
1 parent 989f1a0 commit 61bca1f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Release
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "*"
77

88
permissions:
99
contents: write

tools/bump_version.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ def __post_init__(self) -> None:
4141
PROJECT_DIR / "gaussdb/pyproject.toml",
4242
],
4343
history_file=PROJECT_DIR / "docs/news.rst",
44-
tag_format="{version}",
44+
tag_format="v{version}",
4545
extras=[],
4646
)
4747

4848
Package(
4949
name="gaussdb_pool",
5050
toml_files=[PROJECT_DIR / "gaussdb_pool/pyproject.toml"],
5151
history_file=PROJECT_DIR / "docs/news_pool.rst",
52-
tag_format="pool-{version}",
52+
tag_format="pool-v{version}",
5353
extras=[],
5454
)
5555

5656
Package(
5757
name="isort_gaussdb",
5858
toml_files=[PROJECT_DIR / "tools/isort-gaussdb/pyproject.toml"],
5959
history_file=PROJECT_DIR / "docs/news_isort.rst",
60-
tag_format="isort-{version}",
60+
tag_format="isort-v{version}",
6161
extras=[],
6262
)
6363

@@ -166,7 +166,7 @@ def create_tag(self) -> None:
166166
167167
{''.join(changes)}
168168
"""
169-
cmdline = ["git", "tag", "-a", "-m", msg, tag_name]
169+
cmdline = ["git", "tag", "-a", "-f", "-m", msg, tag_name]
170170
sp.check_call(cmdline)
171171

172172
def _parse_version_from_file(self, fp: Path) -> Version:
@@ -275,17 +275,18 @@ def main() -> int | None:
275275
bump_level = opt.level
276276
else:
277277
bump_level = None
278-
bumper = Bumper(packages[opt.package], bump_level=bump_level)
279-
logger.info("current version: %s", bumper.current_version)
280-
logger.info("bumping to version: %s", bumper.want_version)
281-
282-
if opt.actions is None or Action.UPDATE in opt.actions:
283-
bumper.update_files()
284-
if opt.actions is None or Action.COMMIT in opt.actions:
285-
bumper.commit()
286-
if opt.actions is None or Action.TAG in opt.actions:
287-
if opt.level != BumpLevel.DEV:
288-
bumper.create_tag()
278+
for pkg_name in opt.package:
279+
bumper = Bumper(packages[pkg_name], bump_level=bump_level)
280+
logger.info("current version: %s", bumper.current_version)
281+
logger.info("bumping to version: %s", bumper.want_version)
282+
283+
if opt.actions is None or Action.UPDATE in opt.actions:
284+
bumper.update_files()
285+
if opt.actions is None or Action.COMMIT in opt.actions:
286+
bumper.commit()
287+
if opt.actions is None or Action.TAG in opt.actions:
288+
if opt.level != BumpLevel.DEV:
289+
bumper.create_tag()
289290

290291
return 0
291292

@@ -319,8 +320,9 @@ def parse_cmdline() -> Namespace:
319320
"-p",
320321
"--package",
321322
choices=list(packages.keys()),
322-
default="gaussdb",
323-
help="the package to bump version [default: %(default)s]",
323+
default=list(packages.keys()),
324+
nargs="*",
325+
help="the package to bump version [default: all]",
324326
)
325327

326328
parser.add_argument(

0 commit comments

Comments
 (0)