From c452d377668ce478a99b3bfb9bfe5df528fbba12 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Mon, 30 Aug 2021 14:34:51 -0400 Subject: [PATCH] Adjusts regular expressions to handle changes made to the Java 11 releases of Alibaba Dragonwell Signed-off-by: Daniel Mikusa --- actions/alibaba-dragonwell-dependency/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actions/alibaba-dragonwell-dependency/main.go b/actions/alibaba-dragonwell-dependency/main.go index 8c50c427..165d58c2 100644 --- a/actions/alibaba-dragonwell-dependency/main.go +++ b/actions/alibaba-dragonwell-dependency/main.go @@ -65,7 +65,7 @@ func main() { candidates := make(map[string]Holder) var candidateVersions []string - re := regexp.MustCompile(`dragonwell-(.+)_.+-ga`) + re := regexp.MustCompile(`(dragonwell-)?(\d+\.\d+\.\d+\.?\d*).*-(ga|GA)`) opt := &github.ListOptions{PerPage: 100} for { rel, rsp, err := gh.Repositories.ListReleases(context.Background(), "alibaba", r, opt) @@ -77,7 +77,7 @@ func main() { for _, a := range r.Assets { if g.MatchString(*a.Name) { if g := re.FindStringSubmatch(*r.TagName); g != nil { - ver := g[1] + ver := g[2] candidateVersions = append(candidateVersions, ver) candidates[ver] = Holder{Assets: r.Assets, URI: *a.BrowserDownloadURL} break @@ -158,7 +158,7 @@ func GetVersion(assets []*github.ReleaseAsset) string { var v string - re = regexp.MustCompile(`JAVA_VERSION="([\d]+)\.([\d]+)\.([\d]+)[_]?([\d]+)?"`) + re = regexp.MustCompile(`JAVA_VERSION="([\d]+)\.([\d]+)\.([\d]+)[\._]?([\d]+)?"`) if g := re.FindStringSubmatch(string(b)); g != nil { if g[2] == "8" { v = fmt.Sprintf("8.0.%s", g[4])