Skip to content

Commit

Permalink
Merge pull request #28 from speakeasy-api/chase/speakeasy-version
Browse files Browse the repository at this point in the history
feat: add speakeasyVersion field
  • Loading branch information
chase-crumbaugh authored Apr 10, 2024
2 parents d8d7c31 + 2636418 commit 28d814a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ const (

// Ensure your update schema/workflow.schema.json on changes
type Workflow struct {
Version string `yaml:"workflowVersion"`
Sources map[string]Source `yaml:"sources"`
Targets map[string]Target `yaml:"targets"`
Version string `yaml:"workflowVersion"`
SpeakeasyVersion Version `yaml:"speakeasyVersion,omitempty"`
Sources map[string]Source `yaml:"sources"`
Targets map[string]Target `yaml:"targets"`
}

type Version string

func Load(dir string) (*Workflow, string, error) {
res, err := workspace.FindWorkspace(dir, workspace.FindWorkspaceOptions{
FindFile: workflowFile,
Expand Down Expand Up @@ -119,3 +122,15 @@ func validateSecret(secret string) error {

return nil
}

func (v Version) String() string {
if v == "" || v == "latest" {
return "latest"
}

if !strings.HasPrefix(string(v), "v") {
return "v" + string(v)
}

return string(v)
}

0 comments on commit 28d814a

Please sign in to comment.