| | | 1 | | package domain |
| | | 2 | | |
| | | 3 | | // Step represents a named step in the release lifecycle. |
| | | 4 | | type Step string |
| | | 5 | | |
| | | 6 | | const ( |
| | | 7 | | StepVerifyConditions Step = "verifyConditions" |
| | | 8 | | StepAnalyzeCommits Step = "analyzeCommits" |
| | | 9 | | StepVerifyRelease Step = "verifyRelease" |
| | | 10 | | StepGenerateNotes Step = "generateNotes" |
| | | 11 | | StepPrepare Step = "prepare" |
| | | 12 | | StepPublish Step = "publish" |
| | | 13 | | StepAddChannel Step = "addChannel" |
| | | 14 | | StepSuccess Step = "success" |
| | | 15 | | StepFail Step = "fail" |
| | | 16 | | ) |
| | | 17 | | |
| | | 18 | | // String returns the string representation of the lifecycle step. |
| | 9 | 19 | | func (s Step) String() string { |
| | 9 | 20 | | return string(s) |
| | 9 | 21 | | } |
| | | 22 | | |
| | | 23 | | // StepOrder defines the canonical execution order for lifecycle steps. |
| | | 24 | | var StepOrder = []Step{ |
| | | 25 | | StepVerifyConditions, |
| | | 26 | | StepAnalyzeCommits, |
| | | 27 | | StepVerifyRelease, |
| | | 28 | | StepGenerateNotes, |
| | | 29 | | StepPrepare, |
| | | 30 | | StepPublish, |
| | | 31 | | StepAddChannel, |
| | | 32 | | StepSuccess, |
| | | 33 | | StepFail, |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | // ReleaseContext holds all state passed through the lifecycle pipeline. |
| | | 37 | | type ReleaseContext struct { |
| | | 38 | | Config Config |
| | | 39 | | Branch string |
| | | 40 | | BranchPolicy *BranchPolicy |
| | | 41 | | Projects []Project |
| | | 42 | | Commits []Commit |
| | | 43 | | Plan *ReleasePlan |
| | | 44 | | Result *ReleaseResult |
| | | 45 | | DryRun bool |
| | | 46 | | CI bool |
| | | 47 | | RepositoryURL string |
| | | 48 | | RepositoryRoot string |
| | | 49 | | |
| | | 50 | | // Per-project state populated during pipeline execution. |
| | | 51 | | CurrentProject *ProjectReleasePlan |
| | | 52 | | Notes string // generated release notes for current project |
| | | 53 | | TagName string |
| | | 54 | | Error error // set when fail step is invoked |
| | | 55 | | } |
| | | 56 | | |
| | | 57 | | // GitIdentity configures the git author/committer for automated commits. |
| | | 58 | | type GitIdentity struct { |
| | | 59 | | Name string `mapstructure:"name"` |
| | | 60 | | Email string `mapstructure:"email"` |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | // DefaultGitIdentity returns the default bot identity. |
| | | 64 | | func DefaultGitIdentity() GitIdentity { |
| | | 65 | | return GitIdentity{ |
| | | 66 | | Name: "semantic-release-bot", |
| | | 67 | | Email: "semantic-release-bot@users.noreply.github.com", |
| | | 68 | | } |
| | | 69 | | } |