<!-- If applied, this commit will... -->
In a `brews` section, goreleaser will fail when using `format: tar.xz`
even though homebrew supports installing binaries bundled in a `.tar.xz`
archive.
<!-- Why is this change being made? -->
I use `.tar.xz` instead of `.tar.gz` and would like goreleaser to
support this when used in conjunction with `brews` sections.
With this patch, I created a test [homebrew
formulae](https://github.com/jftuga/homebrew-tap/blob/main/awswho.rb)
and successfully installed it under macOS.
Closes#4421
I chose to keep `getProfileID` as `getProfileIDLegacy` and use it as a
fallback if `getProfileSub` fails because of permission scope.
In this way, it's not a breaking change because one that has only a
deprecated permissions such as `r_liteprofile` will still be able to hit
`v2/me`
this logic is encapsulated in the new function `getProfileURN`, that
resolves the user identifier and returns it formatted as a URN
---------
Co-authored-by: Gabriel F Cipriano <gabriel.cipriano@farme.com.br>
the release's defaults run before the project's does, so, usually the
github/gitlab/gitea names are set.
however, in some cases, the release's defaults might be skipped, in
which case they'll be empty.
this breaks things like `goreleaser changelog`, especially on non-go
repositories.
this pr tries to extract the project name from the git remote url in the
project's defaulter.
it might be possible now to move it to run before the release defaulter,
even.
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
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>
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>
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>
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>