Add the ability to restrict publish plugins to a specific branch

This commit is contained in:
Matt Martz
2014-04-28 21:28:07 -05:00
parent e1156bf53c
commit 509d0ec23b
5 changed files with 21 additions and 7 deletions

View File

@@ -517,7 +517,7 @@ func (b *Builder) writeBuildScript(dir string) error {
// we should only execute the build commands,
// and omit the deploy and publish commands.
if len(b.Repo.PR) == 0 {
b.Build.Write(f)
b.Build.Write(f, b.Repo)
} else {
// only write the build commands
b.Build.WriteBuild(f)

View File

@@ -10,6 +10,7 @@ import (
"github.com/drone/drone/pkg/build/buildfile"
"github.com/drone/drone/pkg/build/git"
"github.com/drone/drone/pkg/build/repo"
"github.com/drone/drone/pkg/plugin/deploy"
"github.com/drone/drone/pkg/plugin/notify"
"github.com/drone/drone/pkg/plugin/publish"
@@ -81,13 +82,13 @@ type Build struct {
// Write adds all the steps to the build script, including
// build commands, deploy and publish commands.
func (b *Build) Write(f *buildfile.Buildfile) {
func (b *Build) Write(f *buildfile.Buildfile, r *repo.Repo) {
// append build commands
b.WriteBuild(f)
// write publish commands
if b.Publish != nil {
b.Publish.Write(f)
b.Publish.Write(f, r)
}
// write deployment commands