Skip to content

Commit

Permalink
Merge pull request #681 from paketo-buildpacks/action-fixes
Browse files Browse the repository at this point in the history
Action fixes
  • Loading branch information
pivotal-david-osullivan authored May 10, 2022
2 parents ce70963 + eb306ab commit 4eceafe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion actions/alibaba-dragonwell-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func main() {
for _, a := range r.Assets {
if globRegex.MatchString(*a.Name) {
version := tag[1]
if strings.HasPrefix(tag[1], "8u") {
if strings.HasPrefix(version, "8u") {
version = fmt.Sprintf("8.0.%s", strings.TrimLeft(version, "8u"))
}
versions[version] = *a.BrowserDownloadURL
Expand Down
2 changes: 1 addition & 1 deletion actions/foojay-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func LoadPackages(d string, t string, v int) actions.Versions {
}
versions[version] = LoadDownloadURI(result.Links.URI)
} else {
fmt.Println(result.JavaVersion, "failed to parse")
panic(fmt.Errorf(result.JavaVersion, "failed to parse"))
}
}

Expand Down
12 changes: 4 additions & 8 deletions actions/graalvm-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ func main() {

url := versions[latestVersion.Original()]

if productType == JDKProductType {
latestVersion = semver.MustParse(GetVersion(url))
}
latestVersion = semver.MustParse(GetVersion(url))

outputs, err := actions.NewOutputs(url, latestVersion, nil)
if err != nil {
Expand All @@ -138,6 +136,9 @@ func main() {
}

func GetVersion(uri string) string {
// for native-image installer, we convert the URL to the graalvm-ce download URL to fetch the version
uri = strings.Replace(strings.Replace(uri, ".jar", ".tar.gz", 1), "native-image-installable-svm-", "graalvm-ce-", 1)

resp, err := http.Get(uri)
if err != nil {
panic(fmt.Errorf("unable to get %s\n%w", uri, err))
Expand Down Expand Up @@ -186,8 +187,3 @@ func GetVersion(uri string) string {

panic(fmt.Errorf("unable to find file that matches %s", re.String()))
}

type Holder struct {
Assets []*github.ReleaseAsset
URI string
}

0 comments on commit 4eceafe

Please sign in to comment.