fix(release): idempotent bump/tag, push current branch, ignore state file
Docker / build (push) Has been cancelled
Docker / build (push) Has been cancelled
This commit is contained in:
@@ -52,3 +52,4 @@ runs/
|
||||
|
||||
# local runtime artifacts (scope tokens, control DBs)
|
||||
.evoscientist/
|
||||
.release-state.json
|
||||
|
||||
+29
-9
@@ -197,12 +197,15 @@ def main(argv=None, *, run=subprocess.run, repo_root: Path | None = None) -> int
|
||||
if args.dry_run:
|
||||
print(f" would set version {target} in pyproject.toml and webui package.json")
|
||||
return
|
||||
text = pyproject.read_text(encoding="utf-8")
|
||||
pyproject.write_text(
|
||||
text.replace(f'version = "{current}"', f'version = "{target}"', 1),
|
||||
encoding="utf-8",
|
||||
)
|
||||
run(["npm", "version", target, "--no-git-tag-version"], cwd=webui).check_returncode()
|
||||
if current != target:
|
||||
text = pyproject.read_text(encoding="utf-8")
|
||||
pyproject.write_text(
|
||||
text.replace(f'version = "{current}"', f'version = "{target}"', 1),
|
||||
encoding="utf-8",
|
||||
)
|
||||
webui_pkg = json.loads((webui / "package.json").read_text(encoding="utf-8"))
|
||||
if webui_pkg.get("version") != target:
|
||||
run(["npm", "version", target, "--no-git-tag-version"], cwd=webui).check_returncode()
|
||||
|
||||
dist = backend / "dist" / f"release-{target}"
|
||||
|
||||
@@ -232,9 +235,26 @@ def main(argv=None, *, run=subprocess.run, repo_root: Path | None = None) -> int
|
||||
print(f" would commit+tag v{target} in {r}")
|
||||
continue
|
||||
run(["git", "-C", str(r), "add", "-A"]).check_returncode()
|
||||
run(["git", "-C", str(r), "commit", "-m", msg]).check_returncode()
|
||||
run(["git", "-C", str(r), "tag", f"v{target}"]).check_returncode()
|
||||
run(["git", "-C", str(r), "push", "origin", "main", f"v{target}"]).check_returncode()
|
||||
dirty = run(
|
||||
["git", "-C", str(r), "status", "--porcelain"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
).stdout.strip()
|
||||
if dirty:
|
||||
run(["git", "-C", str(r), "commit", "-m", msg]).check_returncode()
|
||||
have_tag = run(
|
||||
["git", "-C", str(r), "tag", "-l", f"v{target}"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
).stdout.strip()
|
||||
if not have_tag:
|
||||
run(["git", "-C", str(r), "tag", f"v{target}"]).check_returncode()
|
||||
branch = run(
|
||||
["git", "-C", str(r), "branch", "--show-current"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
).stdout.strip()
|
||||
run(["git", "-C", str(r), "push", "origin", branch, f"v{target}"]).check_returncode()
|
||||
|
||||
def create_release():
|
||||
if args.dry_run:
|
||||
|
||||
Reference in New Issue
Block a user