|
| 1 | +import os |
| 2 | +import subprocess |
| 3 | + |
| 4 | +def run_cmd(cmd): |
| 5 | + try: |
| 6 | + return subprocess.run(cmd, capture_output=True, text=True, check=True).stdout.strip() |
| 7 | + except Exception: |
| 8 | + return "" |
| 9 | + |
| 10 | +def main(): |
| 11 | + tag_name = os.environ.get("TAG_NAME", "v-dev") |
| 12 | + commit_sha = run_cmd(["git", "rev-parse", "--short", "HEAD"]) |
| 13 | + |
| 14 | + # Get previous tag |
| 15 | + prev_tag = run_cmd(["git", "describe", "--tags", "--abbrev=0", "HEAD^"]) |
| 16 | + log_range = f"{prev_tag}..HEAD" if prev_tag else "HEAD" |
| 17 | + |
| 18 | + # Get commits |
| 19 | + commits_raw = run_cmd(["git", "log", log_range, "--pretty=format:%s"]) |
| 20 | + commits = [c.strip() for c in commits_raw.split("\n") if c.strip()] if commits_raw else [] |
| 21 | + |
| 22 | + # Categorized lists |
| 23 | + customization = [] |
| 24 | + behavior = [] |
| 25 | + performance = [] |
| 26 | + under_the_hood = [] |
| 27 | + |
| 28 | + for commit in commits: |
| 29 | + commit_lower = commit.lower() |
| 30 | + if any(x in commit_lower for x in ["theme", "color", "appearance", "style", "font", "preset", "outline", "transparency", "opacity"]): |
| 31 | + customization.append(commit) |
| 32 | + elif any(x in commit_lower for x in ["layout", "click", "action", "alarm", "clock", "calendar", "tasks", "steps", "battery", "temp", "weather", "data", "storage", "ram", "screen_time"]): |
| 33 | + behavior.append(commit) |
| 34 | + elif any(x in commit_lower for x in ["perf", "optimize", "cache", "speed", "fast"]): |
| 35 | + performance.append(commit) |
| 36 | + else: |
| 37 | + under_the_hood.append(commit) |
| 38 | + |
| 39 | + # Build release notes markdown |
| 40 | + lines = [] |
| 41 | + lines.append(f"## {tag_name}") |
| 42 | + lines.append(f"Commit: {commit_sha}") |
| 43 | + lines.append("") |
| 44 | + |
| 45 | + lines.append("💖 **Support Our Work**") |
| 46 | + lines.append("We are committed to making our apps as powerful and polished as possible. As an entirely community-funded project, we rely on your support to keep going, please consider becoming a sponsor. A huge thank you to all our current supporters!") |
| 47 | + lines.append("") |
| 48 | + |
| 49 | + lines.append("🚀 **What's New**") |
| 50 | + lines.append("") |
| 51 | + |
| 52 | + if customization: |
| 53 | + lines.append("🎨 **Customization & Appearance**") |
| 54 | + for c in customization: |
| 55 | + lines.append(f"- {c}") |
| 56 | + lines.append("") |
| 57 | + |
| 58 | + if behavior: |
| 59 | + lines.append("⌨️ **Layouts & Keyboard Behavior**") |
| 60 | + for c in behavior: |
| 61 | + lines.append(f"- {c}") |
| 62 | + lines.append("") |
| 63 | + |
| 64 | + if performance: |
| 65 | + lines.append("⚡ **Performance & Spellchecking**") |
| 66 | + for c in performance: |
| 67 | + lines.append(f"- {c}") |
| 68 | + lines.append("") |
| 69 | + |
| 70 | + if under_the_hood: |
| 71 | + lines.append("⚙️ **Under the Hood**") |
| 72 | + for c in under_the_hood: |
| 73 | + lines.append(f"- {c}") |
| 74 | + lines.append("") |
| 75 | + |
| 76 | + lines.append("📦 **Downloads**") |
| 77 | + |
| 78 | + # Ensure file is written correctly |
| 79 | + with open("release_notes.md", "w") as f: |
| 80 | + f.write("\n".join(lines)) |
| 81 | + |
| 82 | +if __name__ == "__main__": |
| 83 | + main() |
0 commit comments