aboutsummaryrefslogtreecommitdiff
path: root/yae.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-11 05:54:14 -0700
committerFuwn <[email protected]>2024-10-11 05:54:19 -0700
commit7d42732046acbe073449bcf8bd98fa3c1bbb0ebf (patch)
tree9f1c0f31c7bf1c2bdb09c5c027fcf005096d4acc /yae.go
parent24ec5c282111f7fcdd70285520e85f0bf019837d (diff)
downloadyae-7d42732046acbe073449bcf8bd98fa3c1bbb0ebf.tar.xz
yae-7d42732046acbe073449bcf8bd98fa3c1bbb0ebf.zip
refactor(yae): simple tag predicate handling
Diffstat (limited to 'yae.go')
-rw-r--r--yae.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/yae.go b/yae.go
index 85502ef..9a2e73d 100644
--- a/yae.go
+++ b/yae.go
@@ -252,7 +252,7 @@ func command(name string, show bool, args ...string) (string, error) {
func fetchLatestGitTag(source Source, show bool) (string, error) {
if source.Type == "git" {
repository := "https://github.com/" + strings.Split(source.URI, "/")[3] + "/" + strings.Split(source.URI, "/")[4]
- remotes, err := command("git", show, "ls-remote", "--tags", repository)
+ remotes, err := command("bash", show, "-c", fmt.Sprintf("git ls-remote --tags %s | awk -F'/' '{print $NF}' | sort -V", repository))
if err != nil {
return "", err
@@ -263,14 +263,10 @@ func fetchLatestGitTag(source Source, show bool) (string, error) {
if source.TagPredicate == "" {
latest = refs[len(refs)-2]
-
- if strings.Contains(latest, "refs/tags/") {
- latest = strings.Split(latest, "/")[2]
- }
} else {
for i := len(refs) - 2; i >= 0; i-- {
if strings.Contains(refs[i], source.TagPredicate) {
- latest = strings.Split(refs[i], "/")[2]
+ latest = refs[i]
break
}