feat(selfupgrade): only GetTestReleaseAPIURL .
This commit is contained in:
parent
7813726ec8
commit
ffd430285b
1 changed files with 4 additions and 14 deletions
|
|
@ -119,8 +119,8 @@ func UpdateSelfFromRelease(releaseURL, platform, arch, programName string) error
|
||||||
// UpdateSelf updates the running executable by fetching the latest release
|
// UpdateSelf updates the running executable by fetching the latest release
|
||||||
// and applying the binary matching programName.
|
// and applying the binary matching programName.
|
||||||
func UpdateSelf(programName string) error {
|
func UpdateSelf(programName string) error {
|
||||||
// Default to test repo for now. Use GetProdReleaseAPIURL() for production.
|
// Use production repo by default.
|
||||||
return UpdateSelfFromRelease(GetTestReleaseAPIURL(), runtime.GOOS, runtime.GOARCH, programName)
|
return UpdateSelfFromRelease(GetProdReleaseAPIURL(), runtime.GOOS, runtime.GOARCH, programName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetReleaseAPIURL returns the GitHub Releases API URL for the given repo owner.
|
// GetReleaseAPIURL returns the GitHub Releases API URL for the given repo owner.
|
||||||
|
|
@ -129,11 +129,6 @@ func GetReleaseAPIURL(owner string) string {
|
||||||
return fmt.Sprintf("https://api.github.com/repos/%s/picoclaw/releases/latest", owner)
|
return fmt.Sprintf("https://api.github.com/repos/%s/picoclaw/releases/latest", owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTestReleaseAPIURL returns the test release API URL (user fork).
|
|
||||||
func GetTestReleaseAPIURL() string {
|
|
||||||
return GetReleaseAPIURL("sky5454")
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetProdReleaseAPIURL returns the production release API URL (upstream).
|
// GetProdReleaseAPIURL returns the production release API URL (upstream).
|
||||||
func GetProdReleaseAPIURL() string {
|
func GetProdReleaseAPIURL() string {
|
||||||
return GetReleaseAPIURL("sipeed")
|
return GetReleaseAPIURL("sipeed")
|
||||||
|
|
@ -149,14 +144,9 @@ func findAssetURL(releaseURL, platform, arch string) (string, error) {
|
||||||
|
|
||||||
apiURL := buildReleaseAPIURL(releaseURL)
|
apiURL := buildReleaseAPIURL(releaseURL)
|
||||||
if apiURL == "" {
|
if apiURL == "" {
|
||||||
// If caller provided an empty releaseURL, default to test repo.
|
// Default to production repo API URL when no explicit release URL is provided.
|
||||||
// Otherwise fall back to production repo API URL.
|
|
||||||
if strings.TrimSpace(releaseURL) == "" {
|
|
||||||
apiURL = GetTestReleaseAPIURL()
|
|
||||||
} else {
|
|
||||||
apiURL = GetProdReleaseAPIURL()
|
apiURL = GetProdReleaseAPIURL()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := http.Get(apiURL)
|
resp, err := http.Get(apiURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue