You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: full gitlab support for brew and scoop (#1084)
* makes context tokentype a public var * passes artifacts object into client upload function. extracts gitlab upload hash from url * adds gitlab url to brew config * build brew formula depending on token type * fixes client for release tests * fixes exiting brew tests * fixes scoop test with dummy client adaption * uses new artifact upload hash * fixes brew usage * updates gitlab createFile for brew * fixes logging for non-existing file in gitlab logging * fix: gitlab createFile * fix: removes encoding from gitlab create and update file opts * fix: gitlab upload and artifact set upload hash * fix: linter * changed artifact item to a pointer in ctx * docs: updates homebrew * feat: enables scoop for gitlab release * fix: scoop panic for pointer access * chore: rename formula build func for brew * chore: brew removes comments * fix: brew tests * test: updates brew tests * docs: updates homebrew * test: for token type not implemented for brew * tests: for multiple linux builds * fix: build artifacts are pointer in scoop * test: for scoop and gitlab * test: for artifacts set upload hash * adds missing files after adaption * chore: removes and clarifies comments * fix: moves artifact upload hash to extra map * adds comment why we initialize the extra map
This commit is contained in:
committed by
Carlos Alexandro Becker
parent
23e275e946
commit
e92bbe32ce
@@ -40,6 +40,8 @@ const (
|
||||
arm = "Arm"
|
||||
binary = "Binary"
|
||||
artifactName = "ArtifactName"
|
||||
// gitlab only
|
||||
artifactUploadHash = "ArtifactUploadHash"
|
||||
)
|
||||
|
||||
// New Template
|
||||
@@ -92,6 +94,11 @@ func (t *Template) WithArtifact(a *artifact.Artifact, replacements map[string]st
|
||||
t.fields[arm] = replace(replacements, a.Goarm)
|
||||
t.fields[binary] = bin.(string)
|
||||
t.fields[artifactName] = a.Name
|
||||
if val, ok := a.Extra["ArtifactUploadHash"]; ok {
|
||||
t.fields[artifactUploadHash] = val
|
||||
} else {
|
||||
t.fields[artifactUploadHash] = ""
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ func TestWithArtifact(t *testing.T) {
|
||||
"shortcommit": "{{.ShortCommit}}",
|
||||
"binary": "{{.Binary}}",
|
||||
"proj": "{{.ProjectName}}",
|
||||
"": "{{.ArtifactUploadHash}}",
|
||||
} {
|
||||
tmpl := tmpl
|
||||
expect := expect
|
||||
@@ -61,6 +62,24 @@ func TestWithArtifact(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("artifact with gitlab ArtifactUploadHash", func(tt *testing.T) {
|
||||
tt.Parallel()
|
||||
uploadHash := "820ead5d9d2266c728dce6d4d55b6460"
|
||||
result, err := New(ctx).WithArtifact(
|
||||
&artifact.Artifact{
|
||||
Name: "another-binary",
|
||||
Goarch: "amd64",
|
||||
Goos: "linux",
|
||||
Goarm: "6",
|
||||
Extra: map[string]interface{}{
|
||||
"ArtifactUploadHash": uploadHash,
|
||||
},
|
||||
}, map[string]string{},
|
||||
).Apply("{{ .ArtifactUploadHash }}")
|
||||
assert.NoError(tt, err)
|
||||
assert.Equal(tt, uploadHash, result)
|
||||
})
|
||||
|
||||
t.Run("artifact without binary name", func(tt *testing.T) {
|
||||
tt.Parallel()
|
||||
result, err := New(ctx).WithArtifact(
|
||||
|
||||
Reference in New Issue
Block a user