Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: announce: slack #2429

Merged
merged 1 commit into from Sep 1, 2021
Merged

Conversation

Dentrax
Copy link
Member

@Dentrax Dentrax commented Aug 25, 2021

This PR adds support for Slack Announce!

Fixes #2425

Signed-off-by: Furkan furkan.turkal@trendyol.com

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 25, 2021
@vercel
Copy link

vercel bot commented Aug 25, 2021

@Dentrax is attempting to deploy a commit to the goreleaser Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, can you add the docs as well?

@Dentrax
Copy link
Member Author

Dentrax commented Aug 25, 2021

lgtm, can you add the docs as well?

Oh, sure! I updated the announce.md file. One thing that I want to get feedback is that with current config, we need to pass each config from the env, like the following:

type Config struct {
	Webhook   string `env:"SLACK_WEBHOOK,notEmpty"`
	Channel   string `env:"SLACK_CHANNEL,notEmpty"`
	Username  string `env:"SLACK_USERNAME"`
	IconEmoji string `env:"SLACK_ICON_EMOJI"`
	IconURL   string `env:"SLACK_ICON_URL"`
}

But I think we can pass only SLACK_WEBHOOK env variable here. Would it make more sense to get other configs in the config.go file?

i.e.

announce:
  slack:
    enabled: true
    message_template: 'Awesome project {{.Tag}} is out!'
    channel: foo
    username: MyAwesomeApp
    icon_emoji: :my-awesome-emoji:

@caarlos0
Copy link
Member

lgtm, can you add the docs as well?

Oh, sure! I updated the announce.md file. One thing that I want to get feedback is that with current config, we need to pass each config from the env, like the following:

type Config struct {
	Webhook   string `env:"SLACK_WEBHOOK,notEmpty"`
	Channel   string `env:"SLACK_CHANNEL,notEmpty"`
	Username  string `env:"SLACK_USERNAME"`
	IconEmoji string `env:"SLACK_ICON_EMOJI"`
	IconURL   string `env:"SLACK_ICON_URL"`
}

But I think we can pass only SLACK_WEBHOOK env variable here. Would it make more sense to get other configs in the config.go file?

i.e.

announce:
  slack:
    enabled: true
    message_template: 'Awesome project {{.Tag}} is out!'
    channel: foo
    username: MyAwesomeApp
    icon_emoji: :my-awesome-emoji:

I think so, yes. We can keep on env only the "secrets".

@codecov
Copy link

codecov bot commented Aug 27, 2021

Codecov Report

Merging #2429 (41a9719) into master (b661a57) will decrease coverage by 0.22%.
The diff coverage is 61.53%.

❗ Current head 41a9719 differs from pull request most recent head fd4940d. Consider uploading reports for the commit fd4940d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2429      +/-   ##
==========================================
- Coverage   83.10%   82.88%   -0.23%     
==========================================
  Files          86       85       -1     
  Lines        6214     6204      -10     
==========================================
- Hits         5164     5142      -22     
- Misses        900      909       +9     
- Partials      150      153       +3     
Impacted Files Coverage Δ
internal/pipe/announce/announce.go 75.00% <ø> (ø)
pkg/config/config.go 90.72% <ø> (ø)
internal/pipe/slack/slack.go 61.53% <61.53%> (ø)
pkg/archive/targz/targz.go 76.00% <0.00%> (-4.00%) ⬇️
pkg/archive/tarxz/tarxz.go 75.51% <0.00%> (-3.07%) ⬇️
internal/pipe/brew/brew.go 78.34% <0.00%> (-0.50%) ⬇️
internal/pipe/nfpm/nfpm.go 94.31% <0.00%> (-0.25%) ⬇️
internal/builders/golang/targets.go 97.08% <0.00%> (-0.11%) ⬇️
pkg/archive/archive.go 100.00% <0.00%> (ø)
pkg/archive/zip/zip.go 78.04% <0.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b661a57...fd4940d. Read the comment docs.

@caarlos0 caarlos0 added this to In progress in Board via automation Aug 27, 2021
@Dentrax
Copy link
Member Author

Dentrax commented Aug 31, 2021

I think so, yes. We can keep on env only the "secrets".

Updated. ✌️

@caarlos0
Copy link
Member

there are some conflicts, can you merge with master? other than that, lgtm 🙏

@Dentrax
Copy link
Member Author

Dentrax commented Sep 1, 2021

Screen Shot 2021-09-01 at 21 47 00

@developer-guy 🤩

Fixes goreleaser#2425

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
@Dentrax
Copy link
Member Author

Dentrax commented Sep 1, 2021

there are some conflicts, can you merge with master? other than that, lgtm 🙏

I think I fixed the conflicts. Can you please review again? 🤗

We tested this new announce on our upcoming private project kink (kind in kubernetes), it will out soon.

Name string `yaml:",omitempty"`
Tap RepoRef `yaml:",omitempty"`
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty"`
CommitMessageTemplate string `yaml:"commit_msg_template,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field needs to stay

@@ -2,7 +2,7 @@
title: Announce
---

GoReleaser can also announce new releases, currently, to Twitter only.
GoReleaser can also announce new releases, currently, to Twitter and Slack only.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GoReleaser can also announce new releases, currently, to Twitter and Slack only.
GoReleaser can also announce new releases, currently, to Twitter, Reddit and Slack only.

Board automation moved this from In progress to Reviewer approved Sep 1, 2021
@caarlos0
Copy link
Member

caarlos0 commented Sep 1, 2021

Will merge and fix the conflict manually

@caarlos0
Copy link
Member

caarlos0 commented Sep 1, 2021

thanks again for the hard work on this 💛

@caarlos0 caarlos0 merged commit aa28f31 into goreleaser:master Sep 1, 2021
Board automation moved this from Reviewer approved to Done Sep 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
Board
Done
Development

Successfully merging this pull request may close these issues.

add Slack as a new GoReleaser Announce
2 participants