Skip to content

Commit

Permalink
updates new-relic action with sources output (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotal-david-osullivan authored Sep 28, 2023
1 parent cdfd2be commit 39ea937
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions actions/new-relic-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func main() {

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

var uri string
switch t {
Expand All @@ -50,6 +51,8 @@ func main() {
versions[v] = fmt.Sprintf(
"https://download.newrelic.com%s/newrelic-php5-%s.%s.%s.%s-linux.tar.gz",
h, p[1], p[2], p[3], p[4])
sources[v] = fmt.Sprintf("https://github.com/newrelic/newrelic-php-agent/archive/refs/tags/v%s.%s.%s.%s.tar.gz",
p[1], p[2], p[3], p[4])
}
})
case "dotnet":
Expand All @@ -64,6 +67,8 @@ func main() {
versions[v] = fmt.Sprintf(
"https://download.newrelic.com%s/newrelic-dotnet-agent_%s.%s.%s_amd64.tar.gz",
h, p[1], p[2], p[3])
sources[v] = fmt.Sprintf("https://github.com/newrelic/newrelic-dotnet-agent/archive/refs/tags/v%s.%s.%s.tar.gz",
p[1], p[2], p[3])
}
})
default:
Expand All @@ -74,9 +79,19 @@ func main() {
panic(err)
}

if o, err := versions.GetLatest(inputs); err != nil {
latestVersion, err := versions.GetLatestVersion(inputs)
if err != nil {
panic(err)
} else {
}
latestSource := actions.Outputs{}
if sources != nil {
latestSource["source"] = sources[latestVersion.Original()]
}

o, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, latestSource)
if err != nil {
panic(err)
}else {
o.Write()
}
}

0 comments on commit 39ea937

Please sign in to comment.