forked from tangalbert919/google-ota-prober
-
Notifications
You must be signed in to change notification settings - Fork 3
/
release.sh
41 lines (36 loc) · 1.38 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
if [ -f update_info.json ]; then
configs=$(jq -r 'keys[]' update_info.json)
for config in $configs
do
new_update=$(jq -r ".[\"$config\"].found" update_info.json)
if [ "$new_update" = "true" ]; then
update_title=$(jq -r ".[\"$config\"].title" update_info.json)
update_device=$(jq -r ".[\"$config\"].device" update_info.json)
update_description=$(jq -r ".[\"$config\"].description" update_info.json)
update_url=$(jq -r ".[\"$config\"].url" update_info.json)
update_size=$(jq -r ".[\"$config\"].size" update_info.json)
# Prepare release notes with proper Markdown formatting
release_notes="
# $update_device
## Changelog:
$update_description
**Size:** $update_size
**Download URL:** $update_url
"
# Check if a release with this title already exists
if ! gh release view "$update_title" &> /dev/null; then
gh release create "$update_title" \
--title "$update_title" \
--notes "$release_notes"
echo "Created new release: $update_title for config $config"
else
echo "Release '$update_title' for config $config already exists. Skipping."
fi
else
echo "No new updates found for config $config"
fi
done
else
echo "update_info.json not found. This might be the first run."
fi