diff --git a/pkg/plugin/publish/npm.go b/pkg/plugin/publish/npm.go index 865e70d8a..42b26165a 100644 --- a/pkg/plugin/publish/npm.go +++ b/pkg/plugin/publish/npm.go @@ -6,11 +6,11 @@ import ( "github.com/drone/drone/pkg/build/buildfile" ) +// use npm trick instead of running npm adduser that requires stdin var npmLoginCmd = ` -npm login < ~/.npmrc +_auth = $(echo "%s:%s" | tr -d "\r\n" | base64) +email = %s EOF ` diff --git a/pkg/plugin/publish/npm_test.go b/pkg/plugin/publish/npm_test.go index d94d7bac6..96c52581d 100644 --- a/pkg/plugin/publish/npm_test.go +++ b/pkg/plugin/publish/npm_test.go @@ -59,10 +59,6 @@ func TestNPMPublish(t *testing.T) { t.Fatalf("Can't unmarshal publish script: %s", err) } - if !strings.Contains(bscr, "npm login") { - t.Error("Expect script to contain login command") - } - if !strings.Contains(bscr, "npm publish") { t.Error("Expect script to contain install command") }