mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
f4cef96055
* feat(gofish): support binary releases Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: improve code Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package gofish
|
|
|
|
type templateData struct {
|
|
Name string
|
|
Desc string
|
|
Homepage string
|
|
Version string
|
|
License string
|
|
ReleasePackages []releasePackage
|
|
}
|
|
|
|
type releasePackage struct {
|
|
DownloadURL string
|
|
SHA256 string
|
|
OS string
|
|
Arch string
|
|
Binaries []binary
|
|
}
|
|
|
|
type binary struct {
|
|
Name, Target string
|
|
}
|
|
|
|
const foodTemplate = `local name = "{{ .Name }}"
|
|
local version = "{{ .Version }}"
|
|
|
|
food = {
|
|
name = name,
|
|
description = "{{ .Desc }}",
|
|
license = "{{ .License }}",
|
|
homepage = "{{ .Homepage }}",
|
|
version = version,
|
|
packages = {
|
|
{{- range $element := .ReleasePackages}}
|
|
{{- if ne $element.OS ""}}
|
|
{
|
|
os = "{{ $element.OS }}",
|
|
arch = "{{ $element.Arch }}",
|
|
url = "{{ $element.DownloadURL }}",
|
|
sha256 = "{{ $element.SHA256 }}",
|
|
resources = {
|
|
{{- range $binary := $element.Binaries }}
|
|
{
|
|
path = "{{ $binary.Name }}",
|
|
installpath = {{if ne $element.OS "windows"}}"bin/{{ $binary.Target }}"{{else}}"bin\\{{ $binary.Target }}"{{end}},
|
|
{{- if ne $element.OS "windows"}}
|
|
executable = true
|
|
{{- end }}
|
|
},
|
|
{{- end }}
|
|
}
|
|
},
|
|
{{- end }}
|
|
{{- end}}
|
|
}
|
|
}`
|