Allow portable drafts to publish to the connected server
This commit is contained in:
@@ -19,6 +19,17 @@ type Draft struct {
|
||||
BaseVersion int `json:"base_version,omitempty"`
|
||||
}
|
||||
|
||||
// ForServer projects publication scope onto a destination without changing the
|
||||
// retained draft. Version numbers belong to the origin, not another server.
|
||||
func (d Draft) ForServer(server string) Draft {
|
||||
if d.Server != "" && d.Server != server {
|
||||
d.CreateOnly = true
|
||||
d.BaseVersion = 0
|
||||
}
|
||||
d.Server = server
|
||||
return d
|
||||
}
|
||||
|
||||
func Directory() (string, error) {
|
||||
if dir := os.Getenv("PIPELINES_DRAFT_DIR"); dir != "" {
|
||||
return filepath.Abs(dir)
|
||||
|
||||
Reference in New Issue
Block a user