mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
fix(bluesky): change default env, fix user agent, update tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
0c97ed1cec
commit
b45c3b1720
@ -10,7 +10,7 @@ import (
|
||||
"github.com/bluesky-social/indigo/lex/util"
|
||||
butil "github.com/bluesky-social/indigo/util"
|
||||
"github.com/bluesky-social/indigo/xrpc"
|
||||
"github.com/caarlos0/env/v9"
|
||||
"github.com/caarlos0/env/v11"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
)
|
||||
@ -26,7 +26,7 @@ func (Pipe) String() string { return "bluesky" }
|
||||
func (Pipe) Skip(ctx *context.Context) bool { return !ctx.Config.Announce.Bluesky.Enabled }
|
||||
|
||||
type Config struct {
|
||||
Password string `env:"BLUESKY_ACCOUNT_PASSWORD,notEmpty"`
|
||||
Password string `env:"BLUESKY_APP_PASSWORD,notEmpty"`
|
||||
}
|
||||
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
@ -74,8 +74,7 @@ func (p Pipe) Announce(ctx *context.Context) error {
|
||||
}
|
||||
|
||||
httpClient := butil.RobustHTTPClient()
|
||||
|
||||
userAgent := fmt.Sprintf("goreleaser/%s", ctx.Version)
|
||||
userAgent := "goreleaser/v1"
|
||||
|
||||
xrpcClient := &xrpc.Client{
|
||||
Client: httpClient,
|
||||
|
@ -38,7 +38,7 @@ func TestAnnounceMissingEnv(t *testing.T) {
|
||||
},
|
||||
})
|
||||
require.NoError(t, bluesky.Pipe{}.Default(ctx))
|
||||
require.EqualError(t, bluesky.Pipe{}.Announce(ctx), `bluesky: env: environment variable "BLUESKY_ACCOUNT_PASSWORD" should not be empty`)
|
||||
require.EqualError(t, bluesky.Pipe{}.Announce(ctx), `bluesky: env: environment variable "BLUESKY_APP_PASSWORD" should not be empty`)
|
||||
}
|
||||
|
||||
func TestSkip(t *testing.T) {
|
||||
@ -60,21 +60,21 @@ func TestSkip(t *testing.T) {
|
||||
|
||||
func TestLive(t *testing.T) {
|
||||
t.SkipNow()
|
||||
t.Setenv("BLUESKY_ACCOUNT_PASSWORD", "TODO")
|
||||
t.Setenv("BLUESKY_APP_PASSWORD", "TODO")
|
||||
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Announce: config.Announce{
|
||||
Bluesky: config.Bluesky{
|
||||
MessageTemplate: "This is a sample announcement from the forthcoming {{ .ProjectName }} Bluesky support. View the details at {{ .ReleaseURL }}",
|
||||
Enabled: true,
|
||||
Username: "jaygles.bsky.social",
|
||||
Username: "caarlos0.dev",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
ctx.Config.ProjectName = "Goreleaser"
|
||||
ctx.ReleaseURL = "https://en.wikipedia.org/wiki/ALF_(TV_series)"
|
||||
ctx.Version = "dev-bluesky"
|
||||
ctx.ReleaseURL = "https://goreleaser.com/customization/announce/bluesky"
|
||||
ctx.Version = "v1.26.0"
|
||||
|
||||
require.NoError(t, bluesky.Pipe{}.Default(ctx))
|
||||
require.NoError(t, bluesky.Pipe{}.Announce(ctx))
|
||||
|
Loading…
x
Reference in New Issue
Block a user