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
|
|
|
)
|
|
|
|
|
2021-12-29 21:02:50 +00:00
|
|
|
func version(v string) *semver.Version {
|
2019-11-17 17:43:01 +00:00
|
|
|
r, _ := semver.NewVersion(v)
|
2021-12-29 21:02:50 +00:00
|
|
|
return r
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 01:06:46 +00:00
|
|
|
func commitlog(ctype string, metadata map[string]string, author 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{
|
2021-02-15 04:47:20 +00:00
|
|
|
Type: ctype,
|
2021-02-14 02:35:31 +00:00
|
|
|
Description: "subject text",
|
|
|
|
IsBreakingChange: breaking,
|
|
|
|
Metadata: metadata,
|
|
|
|
},
|
2022-02-07 01:06:46 +00:00
|
|
|
AuthorName: author,
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-08 01:49:32 +00:00
|
|
|
func releaseNote(version *semver.Version, tag string, date time.Time, sections []ReleaseNoteSection, authorsNames map[string]struct{}) ReleaseNote {
|
2019-11-17 17:43:01 +00:00
|
|
|
return ReleaseNote{
|
2022-02-08 01:49:32 +00:00
|
|
|
Version: version,
|
|
|
|
Tag: tag,
|
|
|
|
Date: date.Truncate(time.Minute),
|
|
|
|
Sections: sections,
|
|
|
|
AuthorsNames: authorsNames,
|
2019-11-17 17:43:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-08 01:49:32 +00:00
|
|
|
func newReleaseNoteCommitsSection(name string, types []string, items []GitCommitLog) ReleaseNoteCommitsSection {
|
|
|
|
return ReleaseNoteCommitsSection{
|
2019-11-17 17:43:01 +00:00
|
|
|
Name: name,
|
2022-02-07 01:06:46 +00:00
|
|
|
Types: types,
|
2019-11-17 17:43:01 +00:00
|
|
|
Items: items,
|
|
|
|
}
|
|
|
|
}
|