Skip to content

Commit

Permalink
Mark the good builds as recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Dec 13, 2023
1 parent 587db53 commit 57153cb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
25 changes: 17 additions & 8 deletions script/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ type downloadOS struct {
}

type downloadAsset struct {
Name string
Size int
URL string
Arch string
Name string
Size int
URL string
Arch string
Recommended bool

os string
osWeight int
Expand Down Expand Up @@ -70,10 +71,11 @@ func main() {
continue
}
filtered = append(filtered, downloadAsset{
Name: a.Name,
Size: a.Size,
URL: a.BrowserDownloadURL,
Arch: humanReadableArch(parts[2]),
Name: a.Name,
Size: a.Size,
URL: a.BrowserDownloadURL,
Arch: humanReadableArch(parts[2]),
Recommended: isRecommended(parts[1], parts[2]),

os: humanReadableOS(parts[1]),
osWeight: osWeight(parts[1]),
Expand Down Expand Up @@ -113,6 +115,13 @@ func main() {
os.Stdout.Write(bs)
}

func isRecommended(os, arch string) bool {
if os == "macos" {
return arch == "universal"
}
return arch == "amd64" || arch == "arm64"
}

func osWeight(os string) int {
// In order of commonality among our users
switch os {
Expand Down
6 changes: 5 additions & 1 deletion static/css/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ img.github-avatar {
height: 64px;
border-radius: 8px;
margin: 16px;
}
}

a.download-recommended {
font-weight: bold;
}
2 changes: 1 addition & 1 deletion themes/default/layouts/shortcodes/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h5>Syncthing <b>{{.version}}</b></h5>
<dd>{{ range $i, $a := .assets }}
{{ if gt $i 0 }} &sdot; {{ end }}
<!-- The weird replace thing is to make spaces and dashes non-breaking so we avoid misleading-looking architecture names in the list -->
<a href="{{$a.url}}">{{replace (replace $a.arch " " "&nbsp;") "-" "&#8209;" | safe.HTML}}</a>
<a href="{{$a.url}}" class="{{if .recommended}}download-recommended{{end}}">{{replace (replace $a.arch " " "&nbsp;") "-" "&#8209;" | safe.HTML}}</a>
{{ end }}</dd>
</dl>
{{ end }}
Expand Down

0 comments on commit 57153cb

Please sign in to comment.