1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-03-03 15:22:25 +02:00

33 lines
832 B
Go
Raw Normal View History

2014-02-07 03:10:01 -07:00
package publish
import (
"github.com/drone/drone/pkg/build/buildfile"
"github.com/drone/drone/pkg/build/repo"
2014-02-07 03:10:01 -07:00
)
// Publish stores the configuration details
// for publishing build artifacts when
// a Build has succeeded
type Publish struct {
2014-03-29 15:18:25 -07:00
S3 *S3 `yaml:"s3,omitempty"`
Swift *Swift `yaml:"swift,omitempty"`
2014-03-29 15:18:25 -07:00
PyPI *PyPI `yaml:"pypi,omitempty"`
2014-02-07 03:10:01 -07:00
}
func (p *Publish) Write(f *buildfile.Buildfile, r *repo.Repo) {
// S3
if p.S3 != nil && (len(p.S3.Branch) == 0 || (len(p.S3.Branch) > 0 && r.Branch == p.S3.Branch)) {
2014-02-07 03:10:01 -07:00
p.S3.Write(f)
}
// Swift
if p.Swift != nil && (len(p.Swift.Branch) == 0 || (len(p.Swift.Branch) > 0 && r.Branch == p.Swift.Branch)) {
p.Swift.Write(f)
}
// PyPI
if p.PyPI != nil && (len(p.PyPI.Branch) == 0 || (len(p.PyPI.Branch) > 0 && r.Branch == p.PyPI.Branch)) {
2014-03-27 22:43:58 -07:00
p.PyPI.Write(f)
}
2014-02-07 03:10:01 -07:00
}