From 3927fc2ef377224c51f9c4e8387cd854245c7024 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Fri, 26 Feb 2021 17:24:57 -0300 Subject: [PATCH 01/10] chore: add brew --- .goreleaser.yml | 68 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index d2ce60741..2591fcabc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,31 +1,57 @@ # Documentation at http://goreleaser.com builds: -- main: ./cmd/auth0 - env: - - CGO_ENABLED=0 - goarch: - - amd64 - goos: - - darwin - - linux - - windows - binary: auth0 + - main: ./cmd/auth0 + env: + - CGO_ENABLED=0 + goarch: + - amd64 + goos: + - darwin + - linux + - windows + binary: auth0 archives: -- replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 - files: - - none* + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 + files: + - none* checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" +brews: + - + tap: + owner: auth0 + name: homebrew-auth0-cli + commit_author: + name: auth0 + email: support@auth0.com + homepage: https://cli.auth0.com + description: Auth0 CLI + install: | + bin.install "auth0" + rm Dir["#{bin}/{auth0-completion.bash,auth0-completion.zsh}"] + system bin/"auth0", "completion", "--shell", "bash" + system bin/"auth0", "completion", "--shell", "zsh" + bash_completion.install "auth0-completion.bash" + zsh_completion.install "auth0-completion.zsh" + (zsh_completion/"_auth0").write <<~EOS + #compdef auth0 + _auth0 () { + local e + e=$(dirname ${funcsourcetrace[1]%:*})/auth0-completion.zsh + if [[ -f $e ]]; then source $e; fi + } + EOS + caveats: "Thanks for installing Auth0 CLI" From 212de189c394f1953893425e5c880917ffdf264d Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Fri, 26 Feb 2021 17:47:15 -0300 Subject: [PATCH 02/10] set a GH token for goreleaser the provided GITHUB_TOKEN is not enough if we need to push to another repo (brew tap): https://github.com/goreleaser/goreleaser-action#limitation --- .github/workflows/goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 4ba810003..dad9d9f52 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -25,4 +25,4 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} From 8d3183104ba07b729842b425f45b46a6577bcd60 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 20:57:35 -0300 Subject: [PATCH 03/10] set tap name --- .goreleaser.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 2591fcabc..d7b450847 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -31,6 +31,7 @@ changelog: - "^test:" brews: - + name: auth0 tap: owner: auth0 name: homebrew-auth0-cli From fb91069ffd6798d99c8c9a9c0ddbe0d74fb07bc3 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 21:30:34 -0300 Subject: [PATCH 04/10] fix: skip login for completion command --- internal/cli/root.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/cli/root.go b/internal/cli/root.go index 9c3292e17..91fe92192 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -45,6 +45,11 @@ func Execute() { return nil } + // Getting the CLI completion script shouldn't trigger a login. + if cmd.Use == "completion" && cmd.Parent().Use == "auth0" { + return nil + } + // Initialize everything once. Later callers can then // freely assume that config is fully primed and ready // to go. From ed726ab5488fba581a75a9aab9bf3cdedd5f6bec Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 21:31:02 -0300 Subject: [PATCH 05/10] fix: brew completion step --- .goreleaser.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index d7b450847..4e348435f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -43,8 +43,8 @@ brews: install: | bin.install "auth0" rm Dir["#{bin}/{auth0-completion.bash,auth0-completion.zsh}"] - system bin/"auth0", "completion", "--shell", "bash" - system bin/"auth0", "completion", "--shell", "zsh" + system bin/"auth0", "completion", "bash" + system bin/"auth0", "completion", "zsh" bash_completion.install "auth0-completion.bash" zsh_completion.install "auth0-completion.zsh" (zsh_completion/"_auth0").write <<~EOS From 490f84bb3694d0532bb799d538c6d728d846aa6b Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 21:41:21 -0300 Subject: [PATCH 06/10] update readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 290c0ef4f..1b25f3365 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,15 @@ Build, test, and manage your integration with **[Auth0](http://auth0.com/)** dir ## Installation ### macOS + +#### Homebrew + +``` +brew install auth0/auth0-cli/auth0 +``` + +#### Manually + 1. Download the binaries from: https://github.com/auth0/auth0-cli/releases/latest/ 1. Extract 1. Move `auth0` to `/usr/local/bin/auth0`, e.g.: `mv ~/Desktop/auth0 /usr/local/bin` From 5afa13eaa46a5e684fe88b3e3817a8d81c73b4a8 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 21:52:00 -0300 Subject: [PATCH 07/10] fix completion props --- internal/cli/completion.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/cli/completion.go b/internal/cli/completion.go index 01adc31eb..75b3a9f3a 100644 --- a/internal/cli/completion.go +++ b/internal/cli/completion.go @@ -8,9 +8,11 @@ import ( func completionCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ - Use: "completion [bash|zsh|fish|powershell]", + Use: "completion", Short: "Setup autocomplete features for this CLI on your terminal", - Long: `To load completions: + Long: `completion [bash|zsh|fish|powershell] + +To load completions: Bash: From ef660c4057fe168e76d0b59c3ceecb5662a614e0 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Sat, 6 Mar 2021 23:04:21 -0300 Subject: [PATCH 08/10] fix: completion from install formula --- .goreleaser.yml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 4e348435f..e85030aeb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -41,18 +41,9 @@ brews: homepage: https://cli.auth0.com description: Auth0 CLI install: | - bin.install "auth0" - rm Dir["#{bin}/{auth0-completion.bash,auth0-completion.zsh}"] - system bin/"auth0", "completion", "bash" - system bin/"auth0", "completion", "zsh" - bash_completion.install "auth0-completion.bash" - zsh_completion.install "auth0-completion.zsh" - (zsh_completion/"_auth0").write <<~EOS - #compdef auth0 - _auth0 () { - local e - e=$(dirname ${funcsourcetrace[1]%:*})/auth0-completion.zsh - if [[ -f $e ]]; then source $e; fi - } - EOS + bin.install "auth0" + + (bash_completion/"auth0").write `#{bin}/auth0 completion bash` + (fish_completion/"auth0.fish").write `#{bin}/auth0 completion fish` + (zsh_completion/"_auth0").write `#{bin}/auth0 completion zsh` caveats: "Thanks for installing Auth0 CLI" From 37a369ef022ac96ec78f95e1027ac2c9ebf9c38c Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Wed, 17 Mar 2021 17:01:12 -0300 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Cyril David --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 44531f51f..51a700662 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,7 +44,7 @@ brews: name: auth0 email: support@auth0.com homepage: https://cli.auth0.com - description: Auth0 CLI + description: Supercharge your developer workflow. install: | bin.install "auth0" From d89d30e6d12f1f25be53c6873a3c560dbbc642f2 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Wed, 17 Mar 2021 17:03:37 -0300 Subject: [PATCH 10/10] Update README.md --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index 1b25f3365..3e659df87 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,6 @@ Build, test, and manage your integration with **[Auth0](http://auth0.com/)** dir ### macOS -#### Homebrew - -``` -brew install auth0/auth0-cli/auth0 -``` - -#### Manually - 1. Download the binaries from: https://github.com/auth0/auth0-cli/releases/latest/ 1. Extract 1. Move `auth0` to `/usr/local/bin/auth0`, e.g.: `mv ~/Desktop/auth0 /usr/local/bin`