Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/version/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 11 additions & 5 deletions src/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
_ "embed"
"encoding/json"
"fmt"
"net/http"
"runtime"
"time"

Expand All @@ -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"
Expand Down Expand Up @@ -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
}