mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
905a1640f1
* feat(announce): added Slack notification options This feature adds support for specifying a richer content in Slack announcements. We may now specify "blocks" and "attachments" to produce better-looking announcement messages. * fixes #2986 The goreleaser configuration only exposes the top-level structures and does not check the validity of the Slack API internal structures. This way, we do not inject hard dependencies on changes in the Slack API. Notice: untyped config parsing introduces a little hack to have yaml and JSON marshaling work together properly. This hack won't be necessary with yaml.v3. How this has been tested? ------------------------- * Added unit tests for the config parsing * Added a (skipped) e2e test. For now, this requires a valid Slack webhook, so I've been able to test this manually. Signed-off-by: Frederic BIDON <fredbi@yahoo.com> * added more unit tests Signed-off-by: Frederic BIDON <fredbi@yahoo.com> * removed yaml.v2 hack Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
1.8 KiB
1.8 KiB
Slack
For it to work, you'll need to create a new Incoming Webhook, and set some environment variables on your pipeline:
SLACK_WEBHOOK
Then, you can add something like the following to your .goreleaser.yaml
config:
# .goreleaser.yaml
announce:
slack:
# Whether its enabled or not.
# Defaults to false.
enabled: true
# Message template to use while publishing.
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}`
message_template: 'Awesome project {{.Tag}} is out!'
# The name of the channel that the user selected as a destination for webhook messages.
channel: '#channel'
# Set your Webhook's user name.
username: ''
# Emoji to use as the icon for this message. Overrides icon_url.
icon_emoji: ''
# URL to an image to use as the icon for this message.
icon_url: ''
# Blocks for advanced formatting, see: https://api.slack.com/messaging/webhooks#advanced_message_formatting
# and https://api.slack.com/messaging/composing/layouts#adding-blocks.
#
# Templating is possible inside this structure.
#
# Attention: goreleaser doesn't check the full structure of the Slack API: please make sure that
# your configuration for advanced message formatting abides by this API.
blocks: []
# Attachments, see: https://api.slack.com/reference/messaging/attachments
#
# Templating is possible inside this structure.
#
# Attention: goreleaser doesn't check the full structure of the Slack API: please make sure that
# your configuration for advanced message formatting abides by this API.
attachments: []
!!! tip Learn more about the name template engine.