diff --git a/.goreleaser.yml b/.goreleaser.yml index 5e0221ee2..e05144879 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,7 +13,7 @@ builds: - -s -w -X github.com/cli/cli/command.Version={{.Version}} -X github.com/cli/cli/command.BuildDate={{time "2006-01-02"}} - -X github.com/cli/cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}} - -X github.com/cli/cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}} - - -X main.updaterEnabled=github/homebrew-gh + - -X main.updaterEnabled=cli/cli goos: - linux - darwin diff --git a/command/root.go b/command/root.go index 58bc27ee9..02ffff646 100644 --- a/command/root.go +++ b/command/root.go @@ -142,13 +142,12 @@ func colorableErr(cmd *cobra.Command) io.Writer { } func changelogURL(version string) string { - path := "https://github.com/github/homebrew-gh" - r := regexp.MustCompile(`^v\d+\.\d+.\d+$`) + path := "https://github.com/cli/cli" + r := regexp.MustCompile(`^\d+\.\d+.\d+(-[\w.]+)?$`) if !r.MatchString(version) { return fmt.Sprintf("%s/releases/latest", path) } - tag := version - url := fmt.Sprintf("%s/releases/tag/%s", path, tag) + url := fmt.Sprintf("%s/releases/tag/v%s", path, version) return url } diff --git a/command/root_test.go b/command/root_test.go index 42a934a76..1da650519 100644 --- a/command/root_test.go +++ b/command/root_test.go @@ -6,22 +6,29 @@ import ( ) func TestChangelogURL(t *testing.T) { - tag := "v0.3.2" - url := fmt.Sprintf("https://github.com/github/homebrew-gh/releases/tag/v0.3.2") + tag := "0.3.2" + url := fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2") result := changelogURL(tag) if result != url { t.Errorf("expected %s to create url %s but got %s", tag, url, result) } + tag = "0.3.2-pre.1" + url = fmt.Sprintf("https://github.com/cli/cli/releases/tag/v0.3.2-pre.1") + result = changelogURL(tag) + if result != url { + t.Errorf("expected %s to create url %s but got %s", tag, url, result) + } + tag = "0.3.5-90-gdd3f0e0" - url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest") + url = fmt.Sprintf("https://github.com/cli/cli/releases/latest") result = changelogURL(tag) if result != url { t.Errorf("expected %s to create url %s but got %s", tag, url, result) } tag = "deadbeef" - url = fmt.Sprintf("https://github.com/github/homebrew-gh/releases/latest") + url = fmt.Sprintf("https://github.com/cli/cli/releases/latest") result = changelogURL(tag) if result != url { t.Errorf("expected %s to create url %s but got %s", tag, url, result)