mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
feat: support arm for linuxbrew (#1113)
This commit is contained in:
parent
4100f65d71
commit
de5676e833
@ -243,10 +243,23 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, artifacts []*artifact.Ar
|
||||
}
|
||||
result.MacOS = down
|
||||
} else if artifact.Goos == "linux" {
|
||||
if result.Linux.DownloadURL != "" {
|
||||
return result, ErrMultipleArchivesSameOS
|
||||
switch artifact.Goarch {
|
||||
case "386", "amd64":
|
||||
if result.Linux.DownloadURL != "" {
|
||||
return result, ErrMultipleArchivesSameOS
|
||||
}
|
||||
result.Linux = down
|
||||
case "arm":
|
||||
if result.Arm.DownloadURL != "" {
|
||||
return result, ErrMultipleArchivesSameOS
|
||||
}
|
||||
result.Arm = down
|
||||
case "arm64":
|
||||
if result.Arm64.DownloadURL != "" {
|
||||
return result, ErrMultipleArchivesSameOS
|
||||
}
|
||||
result.Arm64 = down
|
||||
}
|
||||
result.Linux = down
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,14 @@ var defaultTemplateData = templateData{
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
},
|
||||
Arm: downloadable{
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
},
|
||||
Arm64: downloadable{
|
||||
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz",
|
||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
|
||||
},
|
||||
Name: "Test",
|
||||
Version: "0.1.3",
|
||||
Caveats: []string{},
|
||||
|
@ -16,6 +16,8 @@ type templateData struct {
|
||||
CustomBlock []string
|
||||
MacOS downloadable
|
||||
Linux downloadable
|
||||
Arm downloadable
|
||||
Arm64 downloadable
|
||||
}
|
||||
|
||||
type downloadable struct {
|
||||
@ -36,15 +38,34 @@ class {{ .Name }} < Formula
|
||||
if OS.mac?
|
||||
{{- if .MacOS.DownloadURL }}
|
||||
url "{{ .MacOS.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ .MacOS.SHA256 }}"
|
||||
{{- end }}
|
||||
elsif OS.linux?
|
||||
{{- if .Linux.DownloadURL }}
|
||||
url "{{ .Linux.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ .Linux.SHA256 }}"
|
||||
if Hardware::CPU.intel?
|
||||
url "{{ .Linux.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ .Linux.SHA256 }}"
|
||||
end
|
||||
{{- end }}
|
||||
{{- if or .Arm.DownloadURL .Arm64.DownloadURL }}
|
||||
if Hardware::CPU.arm?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
{{- if .Arm64.DownloadURL }}
|
||||
url "{{ .Arm64.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ .Arm64.SHA256 }}"
|
||||
{{- end }}
|
||||
else
|
||||
{{- if .Arm.DownloadURL }}
|
||||
url "{{ .Arm.DownloadURL }}"
|
||||
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
|
||||
sha256 "{{ .Arm.SHA256 }}"
|
||||
{{- end }}
|
||||
end
|
||||
end
|
||||
{{- end }}
|
||||
end
|
||||
|
||||
{{- with .CustomBlock }}
|
||||
|
15
internal/pipe/brew/testdata/test.rb.golden
vendored
15
internal/pipe/brew/testdata/test.rb.golden
vendored
@ -9,8 +9,19 @@ class Test < Formula
|
||||
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz"
|
||||
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"
|
||||
elsif OS.linux?
|
||||
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
|
||||
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
|
||||
if Hardware::CPU.intel?
|
||||
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz"
|
||||
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
|
||||
end
|
||||
if Hardware::CPU.arm?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm64.tar.gz"
|
||||
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
|
||||
else
|
||||
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Arm.tar.gz"
|
||||
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
devel do
|
||||
|
Loading…
x
Reference in New Issue
Block a user