github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/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  }
    16  
    17  func (p *Publish) Write(f *buildfile.Buildfile, r *repo.Repo) {
    18  	// S3
    19  	if p.S3 != nil && (len(p.S3.Branch) == 0 || (len(p.S3.Branch) > 0 && r.Branch == p.S3.Branch)) {
    20  		p.S3.Write(f)
    21  	}
    22  
    23  	// Swift
    24  	if p.Swift != nil && (len(p.Swift.Branch) == 0 || (len(p.Swift.Branch) > 0 && r.Branch == p.Swift.Branch)) {
    25  		p.Swift.Write(f)
    26  	}
    27  
    28  	// PyPI
    29  	if p.PyPI != nil && (len(p.PyPI.Branch) == 0 || (len(p.PyPI.Branch) > 0 && r.Branch == p.PyPI.Branch)) {
    30  		p.PyPI.Write(f)
    31  	}
    32  }