mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
18 lines
465 B
Go
18 lines
465 B
Go
|
|
package updater
|
||
|
|
|
||
|
|
import (
|
||
|
|
"regexp"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
var GenericUpdaterSemVerRegex = regexp.MustCompile(`\d+\.\d+\.\d+(-[\w.]+)?(.*x-releaser-pleaser-version)`)
|
||
|
|
|
||
|
|
func Generic(info ReleaseInfo) Updater {
|
||
|
|
return func(content string) (string, error) {
|
||
|
|
// We strip the "v" prefix to avoid adding/removing it from the users input.
|
||
|
|
version := strings.TrimPrefix(info.Version, "v")
|
||
|
|
|
||
|
|
return GenericUpdaterSemVerRegex.ReplaceAllString(content, version+"${2}"), nil
|
||
|
|
}
|
||
|
|
}
|