From d0628bbe7be8c25af7f06b65b357122dee071620 Mon Sep 17 00:00:00 2001 From: Ke Zhu Date: Sun, 4 May 2014 13:29:51 -0400 Subject: [PATCH] support publishing to npm --- Makefile | 1 + pkg/plugin/publish/npm.go | 72 ++++++++++++++++++++++++++ pkg/plugin/publish/npm_test.go | 95 ++++++++++++++++++++++++++++++++++ pkg/plugin/publish/publish.go | 6 +++ 4 files changed, 174 insertions(+) create mode 100644 pkg/plugin/publish/npm_test.go diff --git a/Makefile b/Makefile index a1e3476c..93ed269b 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ database/testing \ mail \ model \ plugin/deploy \ +plugin/publish \ queue PKGS := $(addprefix github.com/drone/drone/pkg/,$(PKGS)) .PHONY := test $(PKGS) diff --git a/pkg/plugin/publish/npm.go b/pkg/plugin/publish/npm.go index 30b1a5b2..865e70d8 100644 --- a/pkg/plugin/publish/npm.go +++ b/pkg/plugin/publish/npm.go @@ -1 +1,73 @@ package publish + +import ( + "fmt" + + "github.com/drone/drone/pkg/build/buildfile" +) + +var npmLoginCmd = ` +npm login < 0 && r.Branch == p.PyPI.Branch)) { p.PyPI.Write(f) } + + // NPM + if p.NPM != nil && (len(p.NPM.Branch) == 0 || (len(p.NPM.Branch) > 0 && r.Branch == p.NPM.Branch)) { + p.NPM.Write(f) + } }