Skip to content

Commit 9a096a9

Browse files
Fix GitHub releases: generate proper download tables with sizes and SHA256 hashes
- Update GitHub workflow to use Python for reliable release notes generation instead of complex jq/awk pipeline - Add RELEASE_NOTES.md generation to TypeScript update script - Fix empty release tables issue - now displays complete platform information - Improve README styling with better formatting for latest version and all versions sections
1 parent 2649a3e commit 9a096a9

File tree

7 files changed

+591
-350
lines changed

7 files changed

+591
-350
lines changed

.github/workflows/update.yml

Lines changed: 74 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,80 @@ jobs:
6464
if: steps.git-check.outputs.changes == 'true'
6565
run: |
6666
echo "Generating release notes for v${{ steps.latest.outputs.version }}"
67-
{
68-
echo "# Cursor v${{ steps.latest.outputs.version }}"
69-
echo "Released: ${{ steps.latest.outputs.date }}"
70-
echo
71-
echo "## Downloads"
72-
echo
73-
echo "| Platform | Link | Size | SHA256 |"
74-
echo "| --- | --- | --- | --- |"
75-
jq -r '
76-
.versions[0] as $v |
77-
($v.platforms | to_entries) as $p |
78-
($v.platformDetails // {}) as $d |
79-
$p[] | .key as $k | .value as $u |
80-
($d[$k].sizeBytes // null) as $sz |
81-
($d[$k].sha256 // null) as $sha |
82-
[ $k,
83-
"[Download](" + $u + ")",
84-
(if $sz then ($sz|tonumber) else null end),
85-
(if $sha then ("`" + $sha + "`") else "-" end)
86-
] | @tsv'
87-
version-history.json |
88-
awk -F"\t" '{
89-
size=$3; unit="";
90-
if (size=="") { printf "| %s | %s | - | %s |\n", $1,$2,$4; next }
91-
s=size+0; u[0]="B"; u[1]="KB"; u[2]="MB"; u[3]="GB"; i=0;
92-
while (s>=1024 && i<3) { s=s/1024; i++ }
93-
printf "| %s | %s | %.1f %s | %s |\n", $1,$2,s,u[i],$4;
94-
}'
95-
} > RELEASE_NOTES.md
67+
cat > generate_notes.py << 'EOF'
68+
import json
69+
import sys
70+
71+
with open('version-history.json', 'r') as f:
72+
data = json.load(f)
73+
74+
latest = data['versions'][0]
75+
version = latest['version']
76+
date = latest['date']
77+
78+
print(f"# Cursor v{version}")
79+
print(f"Released: {date}")
80+
print()
81+
print("## Downloads")
82+
print()
83+
print("| Platform | Link | Size | SHA256 |")
84+
print("| --- | --- | --- | --- |")
85+
86+
platforms = latest.get('platforms', {})
87+
details = latest.get('platformDetails', {})
88+
89+
# Define display names
90+
display_names = {
91+
"win32-x64-user": "Windows x64 (User)",
92+
"win32-arm64-user": "Windows ARM64 (User)",
93+
"win32-x64-system": "Windows x64 (System)",
94+
"win32-arm64-system": "Windows ARM64 (System)",
95+
"win32-x64": "Windows x64 (System)",
96+
"win32-arm64": "Windows ARM64 (System)",
97+
"darwin-universal": "macOS (Universal)",
98+
"darwin-arm64": "macOS (Apple Silicon)",
99+
"darwin-x64": "macOS (Intel)",
100+
"linux-x64": "Linux x64 (AppImage)",
101+
"linux-arm64": "Linux ARM64 (AppImage)"
102+
}
103+
104+
# Sort platforms in desired order
105+
sort_order = [
106+
"win32-x64-user", "win32-x64-system", "win32-arm64-user", "win32-arm64-system",
107+
"darwin-universal", "darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"
108+
]
109+
110+
sorted_platforms = sorted(platforms.keys(), key=lambda x: sort_order.index(x) if x in sort_order else 999)
111+
112+
for platform in sorted_platforms:
113+
if platform not in platforms:
114+
continue
115+
url = platforms[platform]
116+
platform_details = details.get(platform, {})
117+
118+
# Format size
119+
size_bytes = platform_details.get('sizeBytes')
120+
if size_bytes:
121+
if size_bytes >= 1024**3:
122+
size_str = f"{size_bytes / (1024**3):.1f} GB"
123+
elif size_bytes >= 1024**2:
124+
size_str = f"{size_bytes / (1024**2):.1f} MB"
125+
elif size_bytes >= 1024:
126+
size_str = f"{size_bytes / 1024:.1f} KB"
127+
else:
128+
size_str = f"{size_bytes} B"
129+
else:
130+
size_str = "-"
131+
132+
# Format SHA256
133+
sha256 = platform_details.get('sha256')
134+
sha_str = f"`{sha256}`" if sha256 else "-"
135+
136+
display_name = display_names.get(platform, platform)
137+
print(f"| {display_name} | [Download]({url}) | {size_str} | {sha_str} |")
138+
EOF
139+
140+
python3 generate_notes.py > RELEASE_NOTES.md
96141
echo "path=RELEASE_NOTES.md" >> $GITHUB_OUTPUT
97142
98143
- name: Create GitHub release

0 commit comments

Comments
 (0)