diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3dad1..275cb42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [v1.0.50] - 2025-??-?? +## [v1.0.53] - 2025-08-?? + +### Fixed +- use zerops proxy to detect zcli latest version + +## [v1.0.52] - 2025-08-22 + +### Fixed +- `ZEROPS_TOKEN` environment variable takes precedence over stored zcli + +## [v1.0.51] - 2025-08-22 + +### Added +- authenticate via present ZEROPS_TOKEN environment variable + +## [v1.0.50] - 2025-08-08 ### Fixed - fix automatic project selection if service is defined diff --git a/src/version/message.go b/src/version/message.go index 37b1abe..32dc8f7 100644 --- a/src/version/message.go +++ b/src/version/message.go @@ -37,6 +37,9 @@ func (_ messageData) LatestUrl() string { } func (d messageData) Output(out io.Writer) error { + if d.LatestVersion() == "v0.0.0" { + return nil + } t, err := template.New("").Parse(messageTemplate) if err != nil { return errors.Wrap(err, "Failed to parse message template") diff --git a/src/version/version.go b/src/version/version.go index 57b1025..2784aa1 100644 --- a/src/version/version.go +++ b/src/version/version.go @@ -8,6 +8,7 @@ import ( _ "embed" "encoding/json" "fmt" + "net/http" "runtime" "time" @@ -17,7 +18,7 @@ import ( ) const ( - apiUrl = "https://api.github.com/repositories/269549268/releases/latest" + apiUrl = "https://api.app-prg1.zerops.io/api/rest/public/zcli/version" ) var version = "local" @@ -91,10 +92,15 @@ func fetch(ctx context.Context) error { if err != nil { return errors.Wrapf(err, "unable to get api response %s", apiUrl) } - - latestResponse = &apiResponse{} - if err := json.Unmarshal(resp.Body, &latestResponse); err != nil { - return errors.Wrap(err, "unable to read api response") + if resp.StatusCode == http.StatusOK { + latestResponse = &apiResponse{} + if err := json.Unmarshal(resp.Body, &latestResponse); err != nil { + return errors.Wrap(err, "unable to read api response") + } + return nil + } + latestResponse = &apiResponse{ + TagName: "v0.0.0", } return nil }