1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

fix: improve chocolatey no archive error handling and docs

closes #4450
This commit is contained in:
Carlos Alexandro Becker 2023-11-29 23:27:05 -03:00
parent 6f598dc9b0
commit 142b94c533
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 10 additions and 6 deletions

View File

@ -17,6 +17,8 @@ import (
"github.com/goreleaser/goreleaser/pkg/context"
)
var errNoWindowsArchive = errors.New("chocolatey requires at least one windows archive")
// nuget package extension.
const nupkgFormat = "nupkg"
@ -112,7 +114,7 @@ func doRun(ctx *context.Context, cl client.ReleaseURLTemplater, choco config.Cho
List()
if len(artifacts) == 0 {
return errors.New("chocolatey requires a windows build and archive")
return errNoWindowsArchive
}
// folderDir is the directory that then will be compressed to make the

View File

@ -64,7 +64,7 @@ func Test_doRun(t *testing.T) {
IDs: []string{"no-app"},
Goamd64: "v1",
},
err: "chocolatey requires a windows build and archive",
err: errNoWindowsArchive.Error(),
},
{
name: "choco command not found",

View File

@ -14,8 +14,7 @@ Available options:
```yaml
# .goreleaser.yaml
chocolateys:
-
# Your app's package name.
- # Your app's package name.
# The value may not contain spaces or character that are not valid for a URL.
# If you want a good separator for words, use '-', not '.'.
#
@ -24,6 +23,7 @@ chocolateys:
# IDs of the archives to use.
# Empty means all IDs.
# Attention: archives must not be in the 'binary' format.
ids:
- foo
- bar
@ -53,7 +53,7 @@ chocolateys:
url_template: "https://github.com/foo/bar/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# App's icon.
icon_url: 'https://rawcdn.githack.com/foo/bar/efbdc760-395b-43f1-bf69-ba25c374d473/icon.png'
icon_url: "https://rawcdn.githack.com/foo/bar/efbdc760-395b-43f1-bf69-ba25c374d473/icon.png"
# Your app's copyright details.
copyright: 2022 Drummer Roll Inc
@ -103,7 +103,7 @@ chocolateys:
# The api key that should be used to push to the chocolatey repository.
#
# WARNING: do not expose your api key in the configuration file!
api_key: '{{ .Env.CHOCOLATEY_API_KEY }}'
api_key: "{{ .Env.CHOCOLATEY_API_KEY }}"
# The source repository that will push the package to.
source_repo: "https://push.chocolatey.org/"
@ -121,8 +121,10 @@ chocolateys:
```
!!! tip
Learn more about the [name template engine](/customization/templates/).
!!! note
GoReleaser will not install `chocolatey`/`choco` nor any of its dependencies
for you.