diff --git a/internal/cmd/root/root.go b/internal/cmd/root/root.go index 1897109..5a1df2f 100644 --- a/internal/cmd/root/root.go +++ b/internal/cmd/root/root.go @@ -109,18 +109,22 @@ func NewCmdRoot(f *cmdutil.Factory, version, commit, date string) (*cobra.Comman if f.AutoCheckUpdate && !f.Debug && version != "dev" { currentVersion := TrimPrefixV(version) + upstreamVersionInfo, err := GetLatestRelease("zeabur/cli") + if err != nil { + return nil + } + upstreamVersion := TrimPrefixV(upstreamVersionInfo.TagName) + + needUpdate, err := IsVersionNewerSemver(upstreamVersion, currentVersion) if err != nil { - f.Log.Warn("Failed to get the latest version info from GitHub") - } else { - needUpdate, err := IsVersionNewerSemver(upstreamVersion, currentVersion) - if err != nil { - f.Log.Warnf("Failed to compare the current version with the latest version: %s", err.Error()) - } else if needUpdate { - f.Log.Infof("A new version of Zeabur CLI is available: %s, you are using %s", upstreamVersion, currentVersion) - f.Log.Infof("Please visit %s to download the latest version", upstreamVersionInfo.URL) - } + return nil + } + + if needUpdate { + f.Log.Infof("A new version of Zeabur CLI is available: %s, you are using %s", upstreamVersion, currentVersion) + f.Log.Infof("Please visit %s to download the latest version", upstreamVersionInfo.URL) } }