mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-11 11:42:15 +02:00
fix: remove .git suffix by default from announcers (#2623)
* fix: remove .git suffix by default from announcers Fixes #2622 Signed-off-by: Furkan <furkan.turkal@trendyol.com> Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com> Co-authored-by: Erkan <erkan.zileli@trendyol.com> * feat(doc): update defaults Signed-off-by: Erkan Zileli <erkan.zileli@trendyol.com> Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com> Co-authored-by: Furkan <furkan.turkal@trendyol.com> Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com> Co-authored-by: Erkan <erkan.zileli@trendyol.com>
This commit is contained in:
parent
b1a0f35b14
commit
8e89e3fde3
@ -16,7 +16,7 @@ const (
|
||||
defaultAuthor = `GoReleaser`
|
||||
defaultColor = "3888754"
|
||||
defaultIcon = "https://goreleaser.com/static/avatar.png"
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
)
|
||||
|
||||
type Pipe struct{}
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
const (
|
||||
defaultColor = "#2D313E"
|
||||
defaultUsername = `GoReleaser`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTitle = `{{ .ProjectName }} {{ .Tag }} is out!`
|
||||
)
|
||||
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultTitleTemplate = `{{ .ProjectName }} {{ .Tag }} is out!`
|
||||
defaultURLTemplate = `{{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultURLTemplate = `{{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
)
|
||||
|
||||
type Pipe struct{}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultUsername = `GoReleaser`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
)
|
||||
|
||||
type Pipe struct{}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultSubjectTemplate = `{{ .ProjectName }} {{ .Tag }} is out!`
|
||||
defaultBodyTemplate = `You can view details from: {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultBodyTemplate = `You can view details from: {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
)
|
||||
|
||||
type Pipe struct{}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
const (
|
||||
defaultColor = "#2D313E"
|
||||
defaultIcon = "https://goreleaser.com/static/avatar.png"
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
defaultMessageTitle = `{{ .ProjectName }} {{ .Tag }} is out!`
|
||||
)
|
||||
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
)
|
||||
|
||||
const defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
const defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
|
||||
type Pipe struct{}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
)
|
||||
|
||||
const defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
const defaultMessageTemplate = `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
|
||||
type Pipe struct{}
|
||||
|
||||
|
@ -169,6 +169,7 @@ func (t *Template) Apply(s string) (string, error) {
|
||||
"toupper": strings.ToUpper,
|
||||
"trim": strings.TrimSpace,
|
||||
"trimprefix": strings.TrimPrefix,
|
||||
"trimsuffix": strings.TrimSuffix,
|
||||
"dir": filepath.Dir,
|
||||
"abs": filepath.Abs,
|
||||
"incmajor": incMajor,
|
||||
|
@ -155,6 +155,7 @@ func TestFuncMap(t *testing.T) {
|
||||
wd, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx.Git.URL = "https://github.com/foo/bar.git"
|
||||
ctx.Git.CurrentTag = "v1.2.4"
|
||||
for _, tc := range []struct {
|
||||
Template string
|
||||
@ -198,6 +199,11 @@ func TestFuncMap(t *testing.T) {
|
||||
Name: "trimprefix",
|
||||
Expected: "1.2.4",
|
||||
},
|
||||
{
|
||||
Template: `{{ trimsuffix .GitURL ".git" }}`,
|
||||
Name: "trimsuffix",
|
||||
Expected: "https://github.com/foo/bar",
|
||||
},
|
||||
{
|
||||
Template: `{{ toupper "test" }}`,
|
||||
Name: "toupper",
|
||||
|
@ -18,7 +18,7 @@ announce:
|
||||
enabled: true
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
|
||||
# Set author of the embed.
|
||||
|
@ -4,6 +4,8 @@ GoReleaser can also announce new releases on social networks, chat rooms and via
|
||||
|
||||
It runs at the very end of the pipeline and can be skipped with the `--skip-announce` flag of the [`release`](/cmd/goreleaser_release/) command, or via the skip property:
|
||||
|
||||
By default, ".git" suffix is removing from `{{ .GitURL }}` variable like this `{{ trimsuffix .GitURL ".git" }}`.
|
||||
|
||||
```yaml
|
||||
# .goreleaser.yml
|
||||
announce:
|
||||
|
@ -20,7 +20,7 @@ announce:
|
||||
title_template: 'GoReleaser {{ .Tag }} was just released!'
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
|
||||
# Color code of the message. You have to use hexadecimal.
|
||||
|
@ -23,7 +23,7 @@ announce:
|
||||
username: ""
|
||||
|
||||
# URL template to use while publishing.
|
||||
# Defaults to `{{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
url_template: 'https://github.com/goreleaser/goreleaser/releases/tag/{{ .Tag }}'
|
||||
|
||||
# Title template to use while publishing.
|
||||
|
@ -16,7 +16,7 @@ announce:
|
||||
enabled: true
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
|
||||
# The name of the channel that the user selected as a destination for webhook messages.
|
||||
|
@ -32,7 +32,7 @@ announce:
|
||||
username: ""
|
||||
|
||||
# Body template to use within the email.
|
||||
# Defaults to `You can view details from: {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `You can view details from: {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
body_template: 'https://github.com/goreleaser/goreleaser/releases/tag/{{ .Tag }}'
|
||||
|
||||
# Subject template to use within the email subject.
|
||||
|
@ -21,7 +21,7 @@ announce:
|
||||
title_template: 'GoReleaser {{ .Tag }} was just released!'
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
|
||||
# Color code of the message. You have to use hexadecimal.
|
||||
|
@ -21,7 +21,7 @@ announce:
|
||||
chat_id: 123456
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
```
|
||||
|
||||
|
@ -19,7 +19,7 @@ announce:
|
||||
enabled: true
|
||||
|
||||
# Message template to use while publishing.
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .GitURL }}/releases/tag/{{ .Tag }}`
|
||||
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ trimsuffix .GitURL ".git" }}/releases/tag/{{ .Tag }}`
|
||||
message_template: 'Awesome project {{.Tag}} is out!'
|
||||
```
|
||||
|
||||
|
@ -68,6 +68,7 @@ On all fields, you have these available functions:
|
||||
| `toupper "v1.2"` | makes input string uppercase. See [ToUpper](https://golang.org/pkg/strings/#ToUpper) |
|
||||
| `trim " v1.2 "` | removes all leading and trailing white space. See [TrimSpace](https://golang.org/pkg/strings/#TrimSpace) |
|
||||
| `trimprefix "v1.2" "v"` | removes provided leading prefix string, if present. See [TrimPrefix](https://golang.org/pkg/strings/#TrimPrefix) |
|
||||
| `trimsuffix "1.2v" "v"` | removes provided trailing suffix string, if present. See [TrimSuffix](https://pkg.go.dev/strings#TrimSuffix) |
|
||||
| `dir .Path` | returns all but the last element of path, typically the path's directory. See [Dir](https://golang.org/pkg/path/filepath/#Dir) |
|
||||
| `abs .ArtifactPath` | returns an absolute representation of path. See [Abs](https://golang.org/pkg/path/filepath/#Abs) |
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user