diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8fa44c38b..d5047a021 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -25,7 +25,7 @@ jobs: env: GH_OAUTH_CLIENT_ID: 178c6fc778ccc68e1d6a GH_OAUTH_CLIENT_SECRET: ${{secrets.OAUTH_CLIENT_SECRET}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}} msi: needs: goreleaser runs-on: windows-latest @@ -79,12 +79,3 @@ jobs: env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} UPLOAD_GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}} - - name: Bump brew formula - if: "!contains(github.ref, '-')" # skip prereleases - uses: mislav/bump-homebrew-formula-action@v1.4 - with: - formula-name: gh - homebrew-tap: github/homebrew-gh - download-url: ${{ steps.copy.outputs.asset-url }} - env: - COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index e05144879..9097addbb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,29 +6,65 @@ release: before: hooks: - go mod tidy + builds: - - binary: bin/gh - main: ./cmd/gh - ldflags: - - -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=cli/cli - goos: - - linux - - darwin - - windows - goarch: - - amd64 + - <<: &build_defaults + binary: bin/gh + main: ./cmd/gh + ldflags: + - -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=cli/cli + id: macos + goos: [darwin] + goarch: [amd64] + - <<: *build_defaults + id: linux + goos: [linux] + goarch: [386, amd64] + - <<: *build_defaults + id: windows + goos: [windows] + goarch: [386, amd64] + archives: - - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + - id: nix + builds: [macos, linux] + <<: &archive_defaults + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" wrap_in_directory: true replacements: darwin: macOS format: tar.gz - format_overrides: - - goos: windows - format: binary + - id: windows + builds: [windows] + <<: *archive_defaults + wrap_in_directory: false + format: zip + +brews: + - name: gh + ids: [nix] + github: + owner: github + name: homebrew-gh + skip_upload: auto + description: GitHub CLI + homepage: https://github.com/cli/cli + custom_block: | + head do + url "https://github.com/cli/cli.git" + depends_on "go" + end + install: | + system "make" if build.head? + bin.install "bin/gh" + (bash_completion/"gh.sh").write `#{bin}/gh completion -s bash` + (zsh_completion/"_gh").write `#{bin}/gh completion -s zsh` + test: | + help_text = shell_output("#{bin}/gh --help") + assert_includes help_text, "Usage:" nfpms: - license: MIT