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

1394 Commits

Author SHA1 Message Date
Carlos Alexandro Becker
6b00bb9664
refactor: use ordered.First (#4362) 2023-10-10 23:16:27 -03:00
Eng Zer Jun
37e3fdee55
refactor(tmpl): avoid unnecessary byte/string conversion (#4356)
We can use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` to avoid unnecessary `[]byte`
conversions and reduce allocations. A one-line change for free
performance gain.

Benchmark:

```go
func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := envOnlyRe.Match([]byte("{{ .Env.FOO }}")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := envOnlyRe.MatchString("{{ .Env.FOO }}"); !match {
			b.Fail()
		}
	}
}
```

Result:

```
goos: linux
goarch: amd64
pkg: github.com/goreleaser/goreleaser/internal/tmpl cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	 4320873	       381.2 ns/op	      16 B/op	       1 allocs/op
BenchmarkMatchString-16    	 5973543	       203.9 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/goreleaser/goreleaser/internal/tmpl	3.366s
```

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-10 09:54:44 -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
f3d2864db3
refactor: improve releases/scm.go a bit (#4334)
use `ApplyAll`

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-29 13:37:43 -03: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
530223c2ac
chore: improvel logs
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-24 19:18:10 +00:00
Carlos Alexandro Becker
41ce3c0304
fix: git.ignore_tags not working (#4322)
also regex is not possible there currenctly, didnt realized it at the
time

refs #4255

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-23 02:37:48 -03:00
Carlos Alexandro Becker
d5a81df6c5
docs: improve tmpl.map
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-20 19:21:30 +00:00
Jo
24347358e9
feat: add map and indexOrDefault template functions (#4317)
Add a new function `map` to template functions.

`map` creates a map from a list of pairs of key values, then you can
convert a key to a value using `.Get`. This simplifies writing
key-mapping templates. For example, the defaule `archives.name_template`

```yaml
name_template: >-
    {{ .ProjectName }}_
    {{- title .Os }}_
    {{- if eq .Arch "amd64" }}x86_64
    {{- else if eq .Arch "386" }}i386
    {{- else }}{{ .Arch }}{{ end }}
    {{- if .Arm }}v{{ .Arm }}{{ end }}
```

becomes

```yaml
name_template: >-
  {{ $arch := map "amd64" "x86_64" "386" "i386" -}}
  {{ .ProjectName }}_
  {{- title .OS }}_
  {{- $arch.Get .Arch .Arch }}
  {{- if .Arm }}v{{ .Arm }}{{ end }}
```

---------

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-20 16:03:46 -03:00
Carlos Alexandro Becker
bedf38cae6
fix(skips): print all steps that will be skipped (#4319)
this will log everything that's being skipped in the beginning of the
release process.

also added some tests to `skips`

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-20 13:15:32 -03:00
Carlos Alexandro Becker
08d63aa5ff
fix(skips): print all steps that will be skipped 2023-09-20 15:03:46 +00:00
Carlos Alexandro Becker
7e638371fd
chore(winget): add comment
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-20 15:03:45 +00:00
Carlos Alexandro Becker
a84f8246c2
test: fix nfpm test after update 2023-09-20 14:15:08 +00:00
Carlos Alexandro Becker
5df77d20a0
test: fix broken tests 2023-09-17 18:11:20 +00:00
Carlos Alexandro Becker
cd2feb3c81
fix(sbom): syft might fail on windows (#4301)
the paths of the artifacts always use forward slashes, and the logic to
handle the relative path stuff inside the sbom pipe did not account for
that.

running the paths through `filepath.Clean` beforehand fixes it.

also improved yamlschema a little bit :) 

closes #4289
2023-09-17 14:23:04 -03:00
Carlos Alexandro Becker
8ef8babedf
feat(winget): support dependencies (#4299)
closes #4296
2023-09-17 14:22:39 -03:00
Carlos Alexandro Becker
0fe02a136a
fix(git): ignore_tags should ignore empty 2023-09-17 17:03:02 +00:00
Carlos Alexandro Becker
16d84c5973
feat: skip pre build hooks 2023-09-17 16:59:34 +00:00
Carlos Alexandro Becker
d90c2ca2f2
fix: skip post-hook on universal binaries as well
closes #4278
2023-09-17 16:56:26 +00:00
Carlos Alexandro Becker
0337a0b3a8
refactor: improve --skip completions
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-17 03:00:15 +00:00
Carlos Alexandro Becker
622c426eb3
refactor: --skip=item (#4272)
Laying the ground work to allow skipping more pipes without adding new
flags et al.

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-16 17:01:20 -03:00
Carlos Alexandro Becker
85c86d61cf
fix: chocolatey push failing (#4300)
tested this on a fake repo, and it seems to fix the problem...

seems like choco does not like when the path has `/` in it, so passing
it through `filepath.Clean` fixes it.

also improved tests a bit, and made a small docs fix.


closes https://github.com/goreleaser/goreleaser/issues/4292
2023-09-16 14:08:11 -03:00
Vedant
cd139a78b5
feat(winget): update manifest schema version & links (#4298)
Use the latest schema `1.5.0` available on winget-pkgs.
2023-09-16 11:01:04 -03:00
Carlos Alexandro Becker
dbec7054ea
test: fix 2023-09-13 17:02:51 +00:00
Duane Waddle
01a93b4329
fix(sbom): Add LOCALAPPDATA to passthroughEnvVars (#4291)
Adds windows-specific `LOCALAPPDATA` to the list of passed through
environment variables.

closes #4290
2023-09-13 13:50:14 -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
91fe5e40c4
fix: improve git info log output
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-07 18:48:48 +00:00
Carlos Alexandro Becker
67039edc35
fix: typo in error message 2023-09-07 18:48:48 +00:00
Carlos Alexandro Becker
5c8b5ced67
test: gomod on old go version
refs #4280

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-07 18:08:56 +00:00
Marcin Białoń
bb175015c7
feat: skip gomod pipe when Go does not support modules (#4280)
<!--

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... -->

The gomod pipe will skip if the Go version does not support modules.

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

I tried to use goreleaser to build a project with Go v1.8.7 and it
failed on `loading go mod information` step. The Go version used doesn't
support `go list -m`.

The build failed with the following error:
```
  • loading go mod information
  ⨯ release failed after 0s                          error=failed to get module path: exit status 2: flag provided but not defined: -m
usage: list [-e] [-f format] [-json] [build flags] [packages]

List lists the packages named by the import paths, one per line.
...
```

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

...
2023-09-07 15:01:57 -03:00
Carlos Alexandro Becker
962429de06
fix(custom_publishers): skip publish is check by publish pipe (#4274)
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-04 16:21:11 -03:00
Carlos Alexandro Becker
da1d3f4fcf
fix(chocolatey): skip publish is check by publish pipe (#4273)
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-04 16:20:58 -03:00
Carlos Alexandro Becker
a962e3b3cf
fix(snapcrafts): skip publish is check by publish pipe (#4275)
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-04 16:20:36 -03: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
a14404f0f3
feat: support WASI (#4230)
`wasip1` is a valid `GOOS` value in the upcoming go 1.21.
2023-09-02 14:43:07 -03:00
Carlos Alexandro Becker
62cc45aa50
feat: templates in upx.enabled (#4269)
refs https://github.com/orgs/goreleaser/discussions/4268
2023-09-01 15:10:29 -03:00
Carlos Alexandro Becker
983cc3755d
feat(docker): retry push if 503 (#4265)
refs https://github.com/orgs/goreleaser/discussions/4263

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-09-01 11:16:16 -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
ecdbf5877c
feat: git.ignore_tags (#4255)
Allows to ignore tags that match the given regex expressions.
2023-08-27 15:57:03 -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
ddbb7c8f6f
fix: improve example config used in init
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-16 13:52:42 +00:00
Carlos Alexandro Becker
f0d0cac469
feat: update to go 1.21 (#4244)
update to go 1.21

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-15 11:15:04 -03:00
Carlos Alexandro Becker
cb093219c1
fix: snapshot should run before before hooks (#4250)
Otherwise .Version will be wrong.

closes #4247
2023-08-15 10:24:53 -03:00
Carlos Alexandro Becker
08e307ea8d
Revert "fix: skip defaults for skipped pipes (#4210)"
This reverts commit dccd68c126.

This breaks `continue` on goreleaser-pro.

Will re-work this for the next release.
2023-08-09 02:43:34 +00:00
Carlos Alexandro Becker
dccd68c126
fix: skip defaults for skipped pipes (#4210)
closes #4208

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-08 22:43:39 -03:00
Carlos Alexandro Becker
c06ba3a94f
feat: publishers.disable (#4239)
allows to disable a specific custom publisher based on a template, akin
to other pipes.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-08 22:43:09 -03:00
Carlos Alexandro Becker
e7ceead889
test: fix
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-08-07 12:11:10 +00:00