github.com/robryk/drone@v0.2.1-0.20140602202253-40fe4305815d/pkg/plugin/publish/publish.go (about) 1 package publish 2 3 import ( 4 "github.com/drone/drone/pkg/build/buildfile" 5 "github.com/drone/drone/pkg/build/repo" 6 ) 7 8 // Publish stores the configuration details 9 // for publishing build artifacts when 10 // a Build has succeeded 11 type Publish struct { 12 S3 *S3 `yaml:"s3,omitempty"` 13 Swift *Swift `yaml:"swift,omitempty"` 14 PyPI *PyPI `yaml:"pypi,omitempty"` 15 NPM *NPM `yaml:"npm,omitempty"` 16 } 17 18 func (p *Publish) Write(f *buildfile.Buildfile, r *repo.Repo) { 19 // S3 20 if p.S3 != nil && (len(p.S3.Branch) == 0 || (len(p.S3.Branch) > 0 && r.Branch == p.S3.Branch)) { 21 p.S3.Write(f) 22 } 23 24 // Swift 25 if p.Swift != nil && (len(p.Swift.Branch) == 0 || (len(p.Swift.Branch) > 0 && r.Branch == p.Swift.Branch)) { 26 p.Swift.Write(f) 27 } 28 29 // PyPI 30 if p.PyPI != nil && (len(p.PyPI.Branch) == 0 || (len(p.PyPI.Branch) > 0 && r.Branch == p.PyPI.Branch)) { 31 p.PyPI.Write(f) 32 } 33 34 // NPM 35 if p.NPM != nil && (len(p.NPM.Branch) == 0 || (len(p.NPM.Branch) > 0 && r.Branch == p.NPM.Branch)) { 36 p.NPM.Write(f) 37 } 38 }