Skip to content

Commit

Permalink
Merge pull request #1300 from paketo-buildpacks/111-adoptium-source
Browse files Browse the repository at this point in the history
Issue #111: Adoptium actions adds source
  • Loading branch information
anthonydahanne authored Oct 6, 2023
2 parents fea2141 + bce02fc commit 32f0008
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions actions/adoptium-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,24 @@ func main() {
}

versions := make(actions.Versions)
sources := make(map[string]string)

for _, r := range raw {
versions[strings.ReplaceAll(r.VersionData.Semver, "+", "-")] = r.Binaries[0].Package.Link
version := strings.ReplaceAll(r.VersionData.Semver, "+", "-")
versions[version] = r.Binaries[0].Package.Link
sources[version] = r.Source.Link
}

latestVersion, err := versions.GetLatestVersion(inputs)
if err != nil {
panic(fmt.Errorf("unable to get latest version\n%w", err))
}
latestSource := actions.Outputs{}
if sources != nil {
latestSource["source"] = sources[latestVersion.Original()]
}

outputs, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, nil)
outputs, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, latestSource)
if err != nil {
panic(fmt.Errorf("unable to create outputs\n%w", err))
}
Expand All @@ -98,6 +106,7 @@ func main() {
type Asset struct {
Binaries []Binary
VersionData VersionData `json:"version_data"`
Source Source
}

type Binary struct {
Expand All @@ -108,6 +117,10 @@ type Package struct {
Link string
}

type Source struct {
Link string
}

type VersionData struct {
Semver string
}

0 comments on commit 32f0008

Please sign in to comment.