refactor: interface for versioning strategy (#109)

This commit is contained in:
Julian Tölle 2024-11-15 18:43:40 +01:00 committed by GitHub
parent 11f8403241
commit ef1d92cff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 12 deletions

View file

@ -10,9 +10,11 @@ import (
"github.com/apricote/releaser-pleaser/internal/git"
)
var _ Strategy = SemVerNextVersion
var SemVer Strategy = semVer{}
func SemVerNextVersion(r git.Releases, versionBump VersionBump, nextVersionType NextVersionType) (string, error) {
type semVer struct{}
func (s semVer) NextVersion(r git.Releases, versionBump VersionBump, nextVersionType NextVersionType) (string, error) {
latest, err := parseSemverWithDefault(r.Latest)
if err != nil {
return "", fmt.Errorf("failed to parse latest version: %w", err)