Develop #3

Merged
metal3d merged 18 commits from develop into master 2022-03-31 12:12:20 +00:00
Showing only changes of commit 2f1840d6fb - Show all commits

View File

@@ -45,16 +45,24 @@ func CheckLatestVersion() (string, []Asset, error) {
var release = struct { var release = struct {
TagName string `json:"tag_name"` TagName string `json:"tag_name"`
Assets []Asset `json:"assets"` Assets []Asset `json:"assets"`
PreRelease bool `json:"prerelease"`
}{} }{}
err = json.NewDecoder(resp.Body).Decode(&release) err = json.NewDecoder(resp.Body).Decode(&release)
if err != nil { if err != nil {
return "", nil, err return "", nil, err
} }
// if it's a prerelease, don't update
if release.PreRelease {
return "", nil, errors.New("Prerelease detected, not updating")
}
// no tag, don't update
if release.TagName == "" { if release.TagName == "" {
return "", nil, errors.New("No release found") return "", nil, errors.New("No release found")
} }
// if the current version is the same as the latest version, don't update
if cmd.Version == release.TagName { if cmd.Version == release.TagName {
fmt.Println("You are using the latest version") fmt.Println("You are using the latest version")
return "", nil, errors.New("You are using the latest version") return "", nil, errors.New("You are using the latest version")