1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipe/gofish/food_template.go

57 lines
1.4 KiB
Go
Raw Normal View History

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}}
}
}`