Skip to content

Commit

Permalink
🐛 use mondoo.com instead of github for latest release version (#2543)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuskimmina authored Nov 9, 2023
1 parent 978b09f commit 04372f6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cnquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io"
"net/http"
"regexp"
"strings"
)

// Version is set via ldflags
Expand Down Expand Up @@ -49,10 +48,11 @@ func GetVersion() string {

// Release represents a GitHub release
type Release struct {
Name string `json:"name"`
Name string `json:"name"`
Version string `json:"version"`
}

var cnqueryGithubReleaseUrl = "https://api.github.com/repos/mondoohq/cnquery/releases/latest"
var cnqueryGithubReleaseUrl = "https://releases.mondoo.com/cnquery/latest.json?ignoreCache=1"

// GetLatestReleaseName fetches the name of the latest release from the specified GitHub repository
func GetLatestReleaseName(url string) (string, error) {
Expand All @@ -76,7 +76,7 @@ func GetLatestReleaseName(url string) (string, error) {
return "", fmt.Errorf("error unmarshalling response: %v", err)
}

return release.Name, nil
return release.Version, nil
}

// GetLatestVersion returns the latest version available on Github
Expand All @@ -85,8 +85,7 @@ func GetLatestVersion() (string, error) {
if err != nil {
return "", err
}
cleanVersion := strings.TrimPrefix(releaseName, "v")
return cleanVersion, nil
return releaseName, nil
}

var coreSemverRegex = regexp.MustCompile(`^(\d+.\d+.\d+)`)
Expand Down

0 comments on commit 04372f6

Please sign in to comment.