1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
Commit Graph

188 Commits

Author SHA1 Message Date
Brad Reynolds
56c5a09f9a
feat: support projectID for gitlab CreateFile (brew, nix, etc) (#4705)
<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Also, add tests and the respective documentation changes as well.

-->
<!-- If applied, this commit will... -->

Allow for using a projectID for a gitlab homebrew tap destination. There
are still some issues here because I can't use our full project name but
one step at a time.

<!-- Why is this change being made? -->

According to the goreleaser [gitlab
doc](https://goreleaser.com/customization/release/#gitlab), gitlab's
project IDs are supported. Before this change that isn't true for
homebrew formulas.

<!-- # Provide links to any relevant tickets, URLs or other resources
-->
Some conversation here:
https://github.com/goreleaser/goreleaser/issues/4664#issuecomment-1986056251.

Co-authored-by: Brad Reynolds <brad@shipium.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-03-17 15:26:04 -03:00
Oleksandr Redko
305663fb5d
test: simplify error asserts with require.ErrorContains (#4640)
The PR refactors tests:
- change two lines `require.Error + require.Contains` with one
`require.ErrorContains`;
- change `require.Error + require.Equal` with `require.EqualError`.
2024-02-19 16:28:06 -03:00
Kirill Nikolaev
ef90821ee7
feat(pipe/release): Mark GitHub releases as non-draft only after all artifacts are uploaded. (#4626)
Previously end-users would see missing artifacts if trying to use latest
version while artifacts are being uploaded.

This currently applies only to GitHub releases. GitLab does not support
drafts, and I don't dare to make the change for Gitea since I don't use
it (and can't test easily).

---------

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-02-19 12:50:47 +00:00
Oleksandr Redko
a9c76d7655
chore: fix all existing lint issues (#4637)
The PR fixes lint issues, pins `golangci-lint` to `v1.56.2`, disables
`only-new-issues`, and enables `fail-on-issues` in the lint workflow.
After this, all new lint issues will fail CI.

The full log of fixed lint issues:
```sh
❯ golangci-lint run
cmd/docs.go:24:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                RunE: func(cmd *cobra.Command, args []string) error {
                           ^
cmd/man.go:26:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                RunE: func(cmd *cobra.Command, args []string) error {
                           ^
cmd/healthcheck.go:36:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                RunE: func(cmd *cobra.Command, args []string) error {
                           ^
cmd/build.go:72:33: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                RunE: timedRunE("build", func(cmd *cobra.Command, args []string) error {
                                              ^
cmd/schema.go:29:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                RunE: func(cmd *cobra.Command, args []string) error {
                           ^
internal/pipe/nix/nix_test.go:547:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
                                require.ErrorAs(t, err, &tt.expectDefaultErrorIs)
                                ^
internal/pipe/nix/nix_test.go:556:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
                                require.ErrorAs(t, err, &tt.expectRunErrorIs)
                                ^
internal/pipe/nix/nix_test.go:567:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
                                require.ErrorAs(t, err, &tt.expectPublishErrorIs)
                                ^
internal/pipe/winget/winget_test.go:709:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
                                require.ErrorAs(t, err, &tt.expectPublishErrorIs)
                                ^
internal/pipe/winget/winget_test.go:728:5: error-is-as: second argument to require.ErrorAs should not be *error (testifylint)
                                require.ErrorAs(t, err, &tt.expectPublishErrorIs)
                                ^
internal/pipe/docker/docker_test.go:56:29: unused-parameter: parameter 'use' seems to be unused, consider removing or renaming it as _ (revive)
                return func(t *testing.T, use string) {
                                          ^
internal/gio/safe_test.go:23:4: go-require: require must only be used in the goroutine running the test function (testifylint)
                        require.Equal(t, 1, s)
                        ^
internal/gio/safe_test.go:24:4: go-require: require must only be used in the goroutine running the test function (testifylint)
                        require.NoError(t, err)
                        ^
internal/pipe/gomod/gomod_proxy_test.go:126:3: useless-assert: asserting of the same variable (testifylint)
                require.Equal(t, ctx.ModulePath, ctx.ModulePath)
                ^
internal/pipe/gomod/gomod_proxy_test.go:152:3: useless-assert: asserting of the same variable (testifylint)
                require.Equal(t, ctx.ModulePath, ctx.ModulePath)
                ^
internal/pipe/gomod/gomod_proxy_test.go:178:3: useless-assert: asserting of the same variable (testifylint)
                require.Equal(t, ctx.ModulePath, ctx.ModulePath)
                ^
internal/pipe/gomod/gomod_proxy_test.go:239:3: useless-assert: asserting of the same variable (testifylint)
                require.Equal(t, ctx.ModulePath, ctx.ModulePath)
                ^
internal/artifact/artifact_test.go:638:46: unused-parameter: parameter 'a' seems to be unused, consider removing or renaming it as _ (revive)
                require.EqualError(t, artifacts.Visit(func(a *Artifact) error {
                                                           ^
internal/pipe/milestone/milestone.go:79: File is not `gofumpt`-ed (gofumpt)

internal/http/http_test.go:217:19: unused-parameter: parameter 'k' seems to be unused, consider removing or renaming it as _ (revive)
        assetOpen = func(k string, a *artifact.Artifact) (*asset, error) {
                         ^
internal/middleware/logging/logging_test.go:12:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
        require.NoError(t, Log("foo", func(ctx *context.Context) error {
                                           ^
internal/middleware/logging/logging_test.go:16:40: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
        require.NoError(t, PadLog("foo", func(ctx *context.Context) error {
                                              ^
internal/pipe/chocolatey/chocolatey_test.go:277:15: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
                        exec: func(cmd string, args ...string) ([]byte, error) {
                                   ^
internal/client/gitlab.go:325: File is not `gofumpt`-ed (gofumpt)

internal/pipe/linkedin/client_test.go:58:77: unused-parameter: parameter 'req' seems to be unused, consider removing or renaming it as _ (revive)
        server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
                                                                                   ^
internal/middleware/errhandler/error_test.go:15:34: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.NoError(t, Handle(func(ctx *context.Context) error {
                                               ^
internal/middleware/errhandler/error_test.go:21:34: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.NoError(t, Handle(func(ctx *context.Context) error {
                                               ^
internal/middleware/errhandler/error_test.go:27:32: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.Error(t, Handle(func(ctx *context.Context) error {
                                             ^
internal/middleware/errhandler/error_test.go:36:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
                                                  ^
internal/middleware/errhandler/error_test.go:42:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
                                                  ^
internal/middleware/errhandler/error_test.go:48:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                require.NoError(t, memo.Wrap(func(ctx *context.Context) error {
                                                  ^
internal/pipe/ko/ko.go:175:29: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
                build.WithBaseImages(func(ctx stdctx.Context, s string) (name.Reference, build.Result, error) {
                                          ^
```
2024-02-19 08:49:39 -03:00
Carlos Alexandro Becker
c9cc1065b4
chore(deps): update go-github to v59 (#4622)
<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Also, add tests and the respective documentation changes as well.

-->


<!-- If applied, this commit will... -->

...

<!-- Why is this change being made? -->

...

<!-- # Provide links to any relevant tickets, URLs or other resources
-->

...

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-02-09 15:43:19 -03:00
Carlos Alexandro Becker
6097ea50f5
fix: possible nil pointers on logs
refs https://github.com/goreleaser/goreleaser/pull/3966/files#r1460694856

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-01-21 21:46:59 -03:00
Carlos Alexandro Becker
ccd8c55b4f
test: run testifylint -fix (#4483)
fix a bunch of tests

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-12-17 15:34:28 -03:00
Carlos Alexandro Becker
aa9986e826
fix(github): do not fail branch creation if it already exists (#4471)
github api is eventually consistent... so, we might ask for the branch,
it might say it does't exist, and when we try and create it, it might
error because it already exists.

this should avoid breaking it

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-12-12 16:12:07 -03:00
Carlos Alexandro Becker
853275f379
feat(deps): update go-github to v57
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-12-04 07:45:55 -03:00
Carlos Alexandro Becker
91c8db3973
fix: github getbranch maxredirects 2023-10-17 15:52:41 +00:00
Carlos Alexandro Becker
1a243dfc0d
feat(deps): update go-github to v56
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-10-14 22:04:41 +00:00
Carlos Alexandro Becker
6b00bb9664
refactor: use ordered.First (#4362) 2023-10-10 23:16:27 -03:00
Carlos Alexandro Becker
7efeeb37c1
refactor: improve ssh key gen on tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-10-06 14:16:58 +00:00
Carlos Alexandro Becker
aba74099bc
style: invert if statement 2023-09-27 02:11:39 +00:00
Carlos Alexandro Becker
26fed97a0d
fix(git): error when pushing to a git repo with no branch
refs https://github.com/orgs/goreleaser/discussions/4321#discussioncomment-7108865
2023-09-26 11:20:15 +00:00
Carlos Alexandro Becker
82200491bd
fix: git client should respect specified branch (#4324)
refs https://github.com/orgs/goreleaser/discussions/4321
2023-09-24 17:07:10 -03:00
Carlos Alexandro Becker
4240a0fdb9
feat(deps): udpate go-github to v55
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-11 13:53:33 +00:00
Carlos Alexandro Becker
8706fd2e89
feat: allow goreleaser to run in gerrit, soft-serve and others (#4271)
Currently, GoReleaser will assume you're running against github, gitea
or gitlab.

You could set `release.disable: true`, but it would still set and try to
use some defaults that could break things up.

Now, if you disable the release, goreleaser will not set these defaults.
It'll also hard error in some cases in which it would happily produce
invalid resources before, namely, if `release.disable` is set, and, for
example, `brews.url_template` is empty (in which case it would try to
use the one from the release, usually github).

closes #4208
2023-09-04 11:23:38 -03:00
Carlos Alexandro Becker
ec0df9ecd5
fix: failing when pull_request.base is empty (#4261)
if the base branch is empty, it'll try to fetch the default branch,
which would fail if base repo name/owner are also empty.

the default behavior when base owner/name are missing is to using
head's, so I changed it do that before trying to get the default branch,
which should fix the issue.
2023-08-27 16:40:40 -03:00
Carlos Alexandro Becker
c91c4b7cd8
feat: improve template error handling (#4256)
- wrap the multiple errors in an internal error with cleaner messaging
- improve testlib.RequireTemplateError and several tests
2023-08-24 22:06:12 -03:00
Carlos Alexandro Becker
53bcbe951a
feat(deps): update go-github to v54 (#4251)
<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Also, add tests and the respective documentation changes as well.

-->


<!-- If applied, this commit will... -->

...

<!-- Why is this change being made? -->

...

<!-- # Provide links to any relevant tickets, URLs or other resources
-->

...

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-24 10:50:36 -03:00
Carlos Alexandro Becker
a726a29d70
fix(winget): improve commit msgs (#4199)
closes  #4198
2023-07-19 22:04:45 -03:00
Hidde Beydals
326a8c885e
feat: support make_latest for GitHub release (#4161)
This commit adds a `make_latest` boolean to the release configuration,
to allow signaling to GitHub if the release should be marked as latest.

Albeit being a boolean, the internal Go type is a string to allow
to distinguish an empty string (default behavior: `true`) from an
explicit `false`.

For more information around the GitHub API field, see

https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

I did not include the `legacy` option, to not adopt something which
appears to be scheduled for removal in the future.

In addition, I opted for `make_latest` over `latest` because the
option is only available for GitHub. Which keeps the latter key
reserved for e.g. future use of a config option which is used across
Git providers.

Fixes #4159

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-07-14 01:45:57 +00:00
Hidde Beydals
9f6a810fbc
Support make_latest for GitHub release (#4161)
This commit adds a `make_latest` boolean to the release configuration,
to allow signaling to GitHub if the release should be marked as latest.

Albeit being a boolean, the internal Go type is a string to allow
to distinguish an empty string (default behavior: `true`) from an
explicit `false`.

For more information around the GitHub API field, see

https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

I did not include the `legacy` option, to not adopt something which
appears to be scheduled for removal in the future.

In addition, I opted for `make_latest` over `latest` because the
option is only available for GitHub. Which keeps the latter key
reserved for e.g. future use of a config option which is used across
Git providers.

Fixes #4159

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-13 22:42:20 -03:00
Carlos Alexandro Becker
a3a15fb18b
test: improve test func names for clients
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-07-14 01:42:00 +00:00
Carlos Alexandro Becker
ecb8dc54d7
test: fix another gitea test 2023-07-14 01:36:48 +00:00
Carlos Alexandro Becker
cd49d184b8
test: fix broken gitea test due to api changes
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-07-14 00:33:34 +00:00
Carlos Alexandro Becker
86beb584bf
fix: improve error message
refs #4160
2023-07-03 19:01:11 +00:00
Carlos Alexandro Becker
f883131e73
fix(github): check rate limit again after sleeping (#4152)
also ensure sleep > 0

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-29 14:00:23 -03:00
Carlos Alexandro Becker
7d485d6399
fix(winget): default commit message
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-26 17:09:18 +00:00
Carlos Alexandro Becker
d085b3ad44
feat(deps): bump github.com/google/go-github/v53 50.1.0 to 53.2.0 (#4146)
updated!

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-26 13:41:47 -03:00
Carlos Alexandro Becker
823bc6062d
feat: make git client support creating multiple files in a single commit (#4107)
extracted from #4081

a little bit of a better impl than there, actually...
2023-06-14 23:52:35 -03:00
Carlos Alexandro Becker
bbcc45b677
feat: support pull request templates (#4105)
check if there is a `.github/PULL_REQUEST_TEMPLATE.md` file, and use it
as body of the pull request if there is.

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-14 23:28:38 -03:00
Ville Skyttä
ef690d07ef
style: spelling and grammar fixes (#4069)
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-05 13:08:57 -03:00
Carlos Alexandro Becker
f6b9ccbd8f
feat(github): allow to open PRs as drafts (#4054)
This allows to open a pull requests as a draft.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-29 15:07:00 -03:00
Carlos Alexandro Becker
773cb91a7a
feat(github): allow to PR cross-repo (#4053)
This allows to open pull requests across repositories on nix, brew, krew
and scoop.

closes #4048

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-29 14:37:10 -03:00
Carlos Alexandro Becker
1f8a7b2fc5
feat(github): avoid rate limits (#4037)
before doing anything, check the `/rate_limits` API... if we have less
than 100 remaining, wait for the reset timer.

closes #4028
2023-05-27 00:15:43 -03:00
Carlos Alexandro Becker
dfcd535e31
fix: improve "pushing" logs for multiple publishers 2023-05-19 14:10:06 +00:00
Carlos Alexandro Becker
6fd5fd45ea
feat: improve output (#3966)
- log keys will be ordered as intended instead of sorted
- paths always relative to cwd

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-02 09:06:35 -03:00
Carlos Alexandro Becker
5bf42b726f
feat: publish taps, krews and scoops to regular git repositories (#3961)
basically redoing #3559 as it got impossible to merge with the many
changes since it was open (which is totally my fault for not merging it
earlier).

Anyhow, still a WIP, going also doing some other related improvements in
the way.

cc/ @graytonio

closes #3559
closes #3525

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Grayton Ward <graytonio.ward@gmail.com>
2023-04-30 10:18:13 -03:00
Carlos Alexandro Becker
8b1c4ead60
feat: allow to PR homebrew taps (#3903)
closes #3485

also fixed a bug in file creation for github: it was always searching
for the file in the default branch

also, we don't need to create the file first, update does both create
and update.

TODO: implement the for krew, scoop, etc...

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-04-06 22:58:06 -03:00
Carlos A Becker
98eb6a2e98
test: fix gitlab test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-20 09:29:14 -03:00
Carlos A Becker
a459911f45
fix: many linting issues
refs #3874

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-19 22:17:18 -03:00
Carlos Alexandro Becker
f544c5ce69
test: testctx pkg (#3807)
alternative to #3806 

the idea is that both `context.New` and `context.Context{}` are never
used in tests.

not sure yet how much I like it, so far code does look a bit more
readable though.

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-02 00:01:11 -03:00
Christoph Witzko
90d8324971
fix(gitlab): correctly prepend/append/keep releases notes (#3765)
Hi, I found a bug in the GitLab client that leads to not correctly
prepend/append/keep releases notes.

This will use the original `Description` instead of the pre-rendered
`DescriptionHTML`. Furthermore, as `include_html_description` is not
enabled, the `DescriptionHTML` field is always empty.

[GitLab
documentation](https://docs.gitlab.com/ee/api/releases/index.html#get-a-release-by-a-tag-name)
2023-02-07 11:19:19 -03:00
Carlos A Becker
71f3952f18
feat(deps): update go-github from v48 to v50 2023-01-26 23:36:02 -03:00
Carlos Alexandro Becker
da2335791a
fix: native changeloger without previous tag (#3668)
closes #3662

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-12-29 10:41:59 -03:00
Ochi Daiki
3734c2d9be
fix: check that the variable resp is not nil (#3670)
# If applied, this commit will

Linked issues will be resolved.

# Why is this change being made?

Because the program will no longer have to refer to nil.

# Provide links to any relevant tickets, URLs or other resources
- https://github.com/goreleaser/goreleaser/issues/3669
2022-12-29 09:29:15 -03:00
Carlos Alexandro Becker
50bd78439c
fix: log request-id on upload error and release create/update (#3608)
this should help when reporting issues to github, especially the magical
"failed successfully" error

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-11-29 21:38:39 -03:00
Carlos A Becker
78fa66ac7e
revert: unneeded release update
refs #3541
refs #3547

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-11-17 23:57:28 -03:00