mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-21 21:03:22 +00:00
Add the ability to restrict publish plugins to a specific branch
This commit is contained in:
@@ -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)
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user