58 lines
2.2 KiB
HTML
58 lines
2.2 KiB
HTML
|
|
{{- /*
|
||
|
|
Latest Furtka release that has an ISO attached, looked up on Forgejo at
|
||
|
|
build time. Returns a dict: version, url (ISO), size (bytes, 0 = unknown),
|
||
|
|
date (time or ""), sha256 ("" when the release has no .iso.sha256), page
|
||
|
|
(release page URL), live (false when the lookup failed and we fell back
|
||
|
|
to site.Params.version). Use via partialCached "release.html" . "release".
|
||
|
|
*/ -}}
|
||
|
|
{{- $repo := printf "%s/%s" site.Params.forgejoURL site.Params.repoPath -}}
|
||
|
|
{{- $v := site.Params.version -}}
|
||
|
|
{{- $out := dict
|
||
|
|
"version" $v
|
||
|
|
"url" (printf "%s/releases/download/%s/furtka-%s.iso" $repo $v $v)
|
||
|
|
"size" 0
|
||
|
|
"date" ""
|
||
|
|
"sha256" ""
|
||
|
|
"page" (printf "%s/releases/tag/%s" $repo $v)
|
||
|
|
"all" (printf "%s/releases" $repo)
|
||
|
|
"live" false
|
||
|
|
-}}
|
||
|
|
{{- $api := printf "%s/api/v1/repos/%s/releases?limit=10" site.Params.forgejoURL site.Params.repoPath -}}
|
||
|
|
{{- with try (resources.GetRemote $api) -}}
|
||
|
|
{{- with .Err -}}
|
||
|
|
{{- warnf "release.html: release lookup failed, using site.Params.version: %s" . -}}
|
||
|
|
{{- else with .Value -}}
|
||
|
|
{{- $done := false -}}
|
||
|
|
{{- range (. | transform.Unmarshal) -}}
|
||
|
|
{{- if and (not $done) (not .draft) -}}
|
||
|
|
{{- $rel := . -}}
|
||
|
|
{{- $iso := "" -}}
|
||
|
|
{{- $sum := "" -}}
|
||
|
|
{{- range .assets -}}
|
||
|
|
{{- if strings.HasSuffix .name ".iso" }}{{ $iso = . }}{{ end -}}
|
||
|
|
{{- if strings.HasSuffix .name ".iso.sha256" }}{{ $sum = . }}{{ end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- with $iso -}}
|
||
|
|
{{- $done = true -}}
|
||
|
|
{{- $out = merge $out (dict
|
||
|
|
"version" $rel.tag_name
|
||
|
|
"url" .browser_download_url
|
||
|
|
"size" .size
|
||
|
|
"date" (time.AsTime $rel.published_at)
|
||
|
|
"page" $rel.html_url
|
||
|
|
"live" true) -}}
|
||
|
|
{{- with $sum -}}
|
||
|
|
{{- with try (resources.GetRemote .browser_download_url) -}}
|
||
|
|
{{- with .Value -}}
|
||
|
|
{{- $hash := index (split (trim .Content " \n") " ") 0 -}}
|
||
|
|
{{- if eq (len $hash) 64 }}{{ $out = merge $out (dict "sha256" $hash) }}{{ end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- end -}}
|
||
|
|
{{- return $out -}}
|