From a75fea4995ccb6f9f2db9eca7b0f036263a5bd1f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 4 Nov 2023 22:55:05 +0100 Subject: [PATCH] fix: ignore version metadata with auto_tag (#60) --- plugin/tags.go | 2 +- plugin/tags_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/tags.go b/plugin/tags.go index 7a04867..404a713 100644 --- a/plugin/tags.go +++ b/plugin/tags.go @@ -55,7 +55,7 @@ func DefaultTags(ref string) ([]string, error) { return []string{"latest"}, err } - if version.PreRelease != "" || version.Metadata != "" { + if version.PreRelease != "" { return []string{ version.String(), }, nil diff --git a/plugin/tags_test.go b/plugin/tags_test.go index 0624155..5f7df4e 100644 --- a/plugin/tags_test.go +++ b/plugin/tags_test.go @@ -32,8 +32,10 @@ func TestDefaultTags(t *testing.T) { {"refs/heads/main", []string{"latest"}}, {"refs/tags/0.9.0", []string{"0.9", "0.9.0"}}, {"refs/tags/1.0.0", []string{"1", "1.0", "1.0.0"}}, + {"refs/tags/v1.0.0+meta", []string{"1", "1.0", "1.0.0"}}, {"refs/tags/v1.0.0", []string{"1", "1.0", "1.0.0"}}, {"refs/tags/v1.0.0-alpha.1", []string{"1.0.0-alpha.1"}}, + {"refs/tags/v1.0.0-alpha", []string{"1.0.0-alpha"}}, } for _, test := range tests {