mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
refactor: move things to packages (#39)
This commit is contained in:
parent
44184a77f9
commit
a0a064d387
32 changed files with 923 additions and 892 deletions
56
internal/versioning/versioning.go
Normal file
56
internal/versioning/versioning.go
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package versioning
|
||||
|
||||
import (
|
||||
"github.com/leodido/go-conventionalcommits"
|
||||
|
||||
"github.com/apricote/releaser-pleaser/internal/git"
|
||||
)
|
||||
|
||||
type Strategy = func(git.Releases, VersionBump, NextVersionType) (string, error)
|
||||
|
||||
type VersionBump conventionalcommits.VersionBump
|
||||
|
||||
const (
|
||||
UnknownVersion VersionBump = iota
|
||||
PatchVersion
|
||||
MinorVersion
|
||||
MajorVersion
|
||||
)
|
||||
|
||||
type NextVersionType int
|
||||
|
||||
const (
|
||||
NextVersionTypeUndefined NextVersionType = iota
|
||||
NextVersionTypeNormal
|
||||
NextVersionTypeRC
|
||||
NextVersionTypeBeta
|
||||
NextVersionTypeAlpha
|
||||
)
|
||||
|
||||
func (n NextVersionType) String() string {
|
||||
switch n {
|
||||
case NextVersionTypeUndefined:
|
||||
return "undefined"
|
||||
case NextVersionTypeNormal:
|
||||
return "normal"
|
||||
case NextVersionTypeRC:
|
||||
return "rc"
|
||||
case NextVersionTypeBeta:
|
||||
return "beta"
|
||||
case NextVersionTypeAlpha:
|
||||
return "alpha"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (n NextVersionType) IsPrerelease() bool {
|
||||
switch n {
|
||||
case NextVersionTypeRC, NextVersionTypeBeta, NextVersionTypeAlpha:
|
||||
return true
|
||||
case NextVersionTypeUndefined, NextVersionTypeNormal:
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue