Skip to content

Commit d0903cd

Browse files
author
LeanBitLab
committed
ci: integrate custom release notes generator
1 parent 8255e56 commit d0903cd

2 files changed

Lines changed: 89 additions & 1 deletion

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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()

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@ jobs:
5454
- name: Build Release APK
5555
run: ./gradlew assembleRelease
5656

57+
- name: Generate Release Notes
58+
env:
59+
TAG_NAME: ${{ github.event.inputs.tag_name || github.ref_name }}
60+
run: python3 .github/scripts/generate_release_notes.py
61+
5762
- name: Create GitHub Release and Upload APK
5863
uses: softprops/action-gh-release@v2
5964
with:
6065
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
61-
generate_release_notes: true
66+
body_path: release_notes.md
6267
files: |
6368
app/build/outputs/apk/release/*.apk
6469
draft: false

0 commit comments

Comments
 (0)