diff --git a/.goreleaser.yml b/.goreleaser.yml index 7782698a1..39a4df536 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,7 +9,7 @@ builds: - -s -w -X github.com/github/gh-cli/command.Version={{.Version}} -X github.com/github/gh-cli/command.BuildDate={{.Date}} - -X github.com/github/gh-cli/context.oauthClientID={{.Env.GH_OAUTH_CLIENT_ID}} - -X github.com/github/gh-cli/context.oauthClientSecret={{.Env.GH_OAUTH_CLIENT_SECRET}} - - -X github.com/github/gh-cli.updaterEnabled=yes + - -X main.updaterEnabled=github/homebrew-gh goos: - linux - darwin diff --git a/Makefile b/Makefile index 0aa490445..14b33040f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BUILD_FILES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}}\ {{end}}' ./...) -GH_VERSION = $(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD) +GH_VERSION ?= $(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD) LDFLAGS := -X github.com/github/gh-cli/command.Version=$(GH_VERSION) $(LDFLAGS) LDFLAGS := -X github.com/github/gh-cli/command.BuildDate=$(shell date +%Y-%m-%d) $(LDFLAGS) ifdef GH_OAUTH_CLIENT_SECRET diff --git a/main.go b/main.go index 67f4b3e3c..56c205335 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ import ( "github.com/mgutz/ansi" ) -var updaterEnabled = "no" +var updaterEnabled = "" func main() { currentVersion := command.Version @@ -42,7 +42,7 @@ Release notes: %s`, currentVersion, newRelease.Version, newRelease.URL) func shouldCheckForUpdate() bool { errFd := os.Stderr.Fd() - return updaterEnabled == "yes" && (isatty.IsTerminal(errFd) || isatty.IsCygwinTerminal(errFd)) + return updaterEnabled != "" && (isatty.IsTerminal(errFd) || isatty.IsCygwinTerminal(errFd)) } func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) { @@ -55,5 +55,6 @@ func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) { return nil, err } - return update.CheckForUpdate(client, "github/homebrew-gh", currentVersion) + repo := updaterEnabled + return update.CheckForUpdate(client, repo, currentVersion) }