You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-09-16 09:26:52 +02:00
fixes
This commit is contained in:
@@ -115,7 +115,7 @@ func (config *ProjectConfig) fillBasicData() {
|
|||||||
}
|
}
|
||||||
if config.NameTemplate == "" {
|
if config.NameTemplate == "" {
|
||||||
config.NameTemplate = "{{.BinaryName}}_{{.Os}}_{{.Arch}}"
|
config.NameTemplate = "{{.BinaryName}}_{{.Os}}_{{.Arch}}"
|
||||||
}
|
}
|
||||||
if config.Archive.Format == "" {
|
if config.Archive.Format == "" {
|
||||||
config.Archive.Format = "tar.gz"
|
config.Archive.Format = "tar.gz"
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@ const formulae = `class {{ .Name }} < Formula
|
|||||||
desc "{{ .Desc }}"
|
desc "{{ .Desc }}"
|
||||||
homepage "{{ .Homepage }}"
|
homepage "{{ .Homepage }}"
|
||||||
url "https://github.com/{{ .Repo }}/releases/download/{{ .Tag }}/{{ .File }}.{{ .Format }}"
|
url "https://github.com/{{ .Repo }}/releases/download/{{ .Tag }}/{{ .File }}.{{ .Format }}"
|
||||||
head "https://github.com/{{ .Repo }}.git"
|
|
||||||
version "{{ .Tag }}"
|
version "{{ .Tag }}"
|
||||||
sha256 "{{ .SHA256 }}"
|
sha256 "{{ .SHA256 }}"
|
||||||
|
|
||||||
@@ -123,7 +122,11 @@ func dataFor(config config.ProjectConfig, client *github.Client) (result templat
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sum, err := sha256sum.For("dist/" + config.BinaryName + "_Darwin_x86_64." + config.Archive.Format)
|
file, err := name.For(config, "darwin", "amd64")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sum, err := sha256sum.For("dist/" + file + config.Archive.Format)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -137,10 +140,6 @@ func dataFor(config config.ProjectConfig, client *github.Client) (result templat
|
|||||||
} else {
|
} else {
|
||||||
description = *rep.Description
|
description = *rep.Description
|
||||||
}
|
}
|
||||||
file, err := fileName(config)
|
|
||||||
if err != nil {
|
|
||||||
return result, err
|
|
||||||
}
|
|
||||||
return templateData{
|
return templateData{
|
||||||
Name: formulaNameFor(config.BinaryName),
|
Name: formulaNameFor(config.BinaryName),
|
||||||
Desc: description,
|
Desc: description,
|
||||||
@@ -155,14 +154,6 @@ func dataFor(config config.ProjectConfig, client *github.Client) (result templat
|
|||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileName(config config.ProjectConfig) (string, error) {
|
|
||||||
return name.For(
|
|
||||||
config,
|
|
||||||
"#{%x(uname -s).gsub(/\n/, '')}",
|
|
||||||
"#{%x(uname -m).gsub(/\n/, '')}",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func formulaNameFor(name string) string {
|
func formulaNameFor(name string) string {
|
||||||
name = strings.Replace(name, "-", " ", -1)
|
name = strings.Replace(name, "-", " ", -1)
|
||||||
name = strings.Replace(name, "_", " ", -1)
|
name = strings.Replace(name, "_", " ", -1)
|
||||||
|
@@ -3,7 +3,6 @@ package brew
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/goreleaser/releaser/config"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ var defaultTemplateData = templateData{
|
|||||||
Name: "Test",
|
Name: "Test",
|
||||||
Repo: "caarlos0/test",
|
Repo: "caarlos0/test",
|
||||||
Tag: "v0.1.3",
|
Tag: "v0.1.3",
|
||||||
File: "test_#{%x(uname -s).gsub(/\\n/, '')}_#{%x(uname -m).gsub(/\\n/, '')}",
|
File: "test_Darwin_x86_64",
|
||||||
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68",
|
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68",
|
||||||
Format: "tar.gz",
|
Format: "tar.gz",
|
||||||
}
|
}
|
||||||
@@ -62,16 +61,3 @@ func TestFormulaeNoCaveats(t *testing.T) {
|
|||||||
assertDefaultTemplateData(t, formulae)
|
assertDefaultTemplateData(t, formulae)
|
||||||
assert.NotContains(formulae, "def caveats")
|
assert.NotContains(formulae, "def caveats")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilename(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
name, err := fileName(config.ProjectConfig{
|
|
||||||
BinaryName: "test",
|
|
||||||
NameTemplate: "{{.BinaryName}}_{{.Os}}_{{.Arch}}",
|
|
||||||
Git: config.GitInfo{
|
|
||||||
CurrentTag: "v1.2.3",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
assert.NoError(err)
|
|
||||||
assert.Equal("test_#{%x(uname -s).gsub(/\n/, '')}_#{%x(uname -m).gsub(/\n/, '')}", name)
|
|
||||||
}
|
|
||||||
|
@@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/goreleaser/releaser/name"
|
"github.com/goreleaser/releaser/name"
|
||||||
"github.com/goreleaser/releaser/pipeline/compress/tar"
|
"github.com/goreleaser/releaser/pipeline/compress/tar"
|
||||||
"github.com/goreleaser/releaser/pipeline/compress/zip"
|
"github.com/goreleaser/releaser/pipeline/compress/zip"
|
||||||
"github.com/goreleaser/releaser/uname"
|
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ func create(system, arch string, config config.ProjectConfig) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return addFile(tw, config.BinaryName+extFor(system), "dist/"+name+"/"+config.BinaryName)
|
return archive.Add(config.BinaryName+extFor(system), "dist/"+name+"/"+config.BinaryName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func archiveFor(file *os.File, format string) Archive {
|
func archiveFor(file *os.File, format string) Archive {
|
||||||
|
@@ -65,10 +65,10 @@ func description(diff string) string {
|
|||||||
|
|
||||||
func upload(client *github.Client, releaseID int, system, arch string, config config.ProjectConfig) error {
|
func upload(client *github.Client, releaseID int, system, arch string, config config.ProjectConfig) error {
|
||||||
owner, repo := split.OnSlash(config.Repo)
|
owner, repo := split.OnSlash(config.Repo)
|
||||||
name, err := name.For(config, system, arch)
|
name, err := name.For(config, system, arch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
name = name + "." + config.Archive.Format
|
name = name + "." + config.Archive.Format
|
||||||
file, err := os.Open("dist/" + name)
|
file, err := os.Open("dist/" + name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user