refactor(changelog): reverted back to commit-chagnelog, like more than changeset for solo dev
This commit is contained in:
@@ -145,12 +145,33 @@ jobs:
|
||||
"---\n\n"
|
||||
)
|
||||
|
||||
body = (
|
||||
header
|
||||
+ changelog_body.rstrip()
|
||||
+ f"\n\n### Container Image\n\n- `{image_name}:{tag}`\n"
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
version = os.environ["VERSION"]
|
||||
changelog_path = Path("CHANGELOG.md")
|
||||
|
||||
if not changelog_path.exists():
|
||||
Path("release_body.md").write_text(f"Release {version}\n", encoding="utf-8")
|
||||
raise SystemExit(0)
|
||||
|
||||
text = changelog_path.read_text(encoding="utf-8")
|
||||
|
||||
pattern = re.compile(
|
||||
rf"^##\s+{re.escape(version)}(?:\s*\([^)]+\))?\n(.*?)(?=^##\s+[0-9]|\Z)",
|
||||
re.MULTILINE | re.DOTALL,
|
||||
)
|
||||
|
||||
match = pattern.search(text)
|
||||
|
||||
if match:
|
||||
body = match.group(1).strip()
|
||||
else:
|
||||
body = f"Release {version}"
|
||||
|
||||
Path("release_body.md").write_text(body + "\n", encoding="utf-8")
|
||||
|
||||
url = f"{server_url}/api/v1/repos/{repo}/releases"
|
||||
payload = {
|
||||
"tag_name": tag,
|
||||
|
||||
Reference in New Issue
Block a user