2019-11-17 17:43:01 +00:00
|
|
|
package sv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2021-02-13 18:40:09 +00:00
|
|
|
"github.com/Masterminds/semver/v3"
|
2019-11-17 17:43:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func version(v string) semver.Version {
|
|
|
|
r, _ := semver.NewVersion(v)
|
|
|
|
return *r
|
|
|
|
}
|
|
|
|
|
|
|
|
func commitlog(t string, metadata map[string]string) GitCommitLog {
|
2021-02-14 02:35:31 +00:00
|
|
|
breaking := false
|
2021-02-15 03:05:43 +00:00
|
|
|
if _, found := metadata[breakingChangeMetadataKey]; found {
|
2021-02-14 02:35:31 +00:00
|
|
|
breaking = true
|
|
|
|
}
|
2019-11-17 17:43:01 +00:00
|
|
|
return GitCommitLog{
|
2021-02-14 02:35:31 +00:00
|
|
|
Message: CommitMessage{
|
|
|
|
Type: t,
|
|
|
|
Description: "subject text",
|
|
|
|
IsBreakingChange: breaking,
|
|
|
|
Metadata: metadata,
|
|
|
|
},
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-25 20:16:56 +00:00
|
|
|
func releaseNote(version *semver.Version, date time.Time, sections map[string]ReleaseNoteSection, breakingChanges []string) ReleaseNote {
|
2019-11-17 17:43:01 +00:00
|
|
|
return ReleaseNote{
|
2020-02-02 00:00:53 +00:00
|
|
|
Version: version,
|
2020-02-01 21:19:38 +00:00
|
|
|
Date: date.Truncate(time.Minute),
|
2019-11-17 17:43:01 +00:00
|
|
|
Sections: sections,
|
|
|
|
BreakingChanges: breakingChanges,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-02 02:51:29 +00:00
|
|
|
func newReleaseNoteSection(name string, items []GitCommitLog) ReleaseNoteSection {
|
2019-11-17 17:43:01 +00:00
|
|
|
return ReleaseNoteSection{
|
|
|
|
Name: name,
|
|
|
|
Items: items,
|
|
|
|
}
|
|
|
|
}
|