diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-28 10:20:02 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-28 10:20:02 +0300 |
| commit | 61ebe59a088af0f758115e63340552f3bbac7c19 (patch) | |
| tree | 1e86f7e8a0ffb487b4831b1cedd414d7e336a9fd /internal/release/release.go | |
| parent | a2242a4f6e65434701e23827e02da71590365a58 (diff) | |
refactor(version): unify version tag detection across packages (gq)
Diffstat (limited to 'internal/release/release.go')
| -rw-r--r-- | internal/release/release.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/internal/release/release.go b/internal/release/release.go index 9ddf563..da2c221 100644 --- a/internal/release/release.go +++ b/internal/release/release.go @@ -8,11 +8,11 @@ import ( "net/http" "os" "os/exec" - "regexp" "sort" "strings" "codeberg.org/snonux/gitsyncer/internal/httpclient" + "codeberg.org/snonux/gitsyncer/internal/version" ) // Tag represents a git tag @@ -117,15 +117,6 @@ func (m *Manager) EnsureCodebergReleasesEnabled(owner, repo string) error { return nil } -// isVersionTag checks if a tag name is a version tag -// Supports formats: vX.Y.Z, vX.Y, vX, X.Y.Z, X.Y, X -func isVersionTag(tag string) bool { - // Pattern matches version tags with optional 'v' prefix - pattern := `^v?\d+(\.\d+)?(\.\d+)?$` - matched, _ := regexp.MatchString(pattern, tag) - return matched -} - // GetLocalTags returns all version tags from the local git repository func (m *Manager) GetLocalTags(repoPath string) ([]string, error) { cmd := exec.Command("git", "-C", repoPath, "tag", "--list") @@ -139,7 +130,7 @@ func (m *Manager) GetLocalTags(repoPath string) ([]string, error) { for _, tag := range tags { tag = strings.TrimSpace(tag) - if tag != "" && isVersionTag(tag) { + if tag != "" && version.IsVersionTag(tag) { versionTags = append(versionTags, tag) } } |
