diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da3b5b7..5dcaebe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,8 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SCOOP_BUCKET_TOKEN: ${{ secrets.SCOOP_BUCKET_TOKEN }} + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} npm: needs: binaries runs-on: ubuntu-latest diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 448ed4b..b51fd0e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -23,6 +23,44 @@ archives: - id: gorse-cli formats: [binary] name_template: "gorse-cli_{{ .Os }}_{{ .Arch }}" + - id: packages + formats: [tar.gz] + format_overrides: + - goos: windows + formats: [zip] + name_template: "gorse-cli_{{ .Os }}_{{ .Arch }}" +scoops: + - name: gorse-cli + ids: [packages] + repository: + owner: gorse-io + name: scoop-bucket + branch: main + token: "{{ .Env.SCOOP_BUCKET_TOKEN }}" + directory: bucket + homepage: "https://github.com/gorse-io/cli" + description: "Command-line tool for Gorse recommender system." + license: Apache-2.0 + skip_upload: auto +brews: + - name: gorse-cli + ids: [packages] + repository: + owner: gorse-io + name: homebrew-tap + branch: main + token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" + directory: Formula + homepage: "https://github.com/gorse-io/cli" + description: "Command-line tool for Gorse cluster management" + license: Apache-2.0 + skip_upload: auto + install: | + bin.install "gorse-cli" + test: | + output = shell_output("#{bin}/gorse-cli --version") + assert_match "Version:", output + assert_match version.to_s, output checksum: disable: true release: diff --git a/README.md b/README.md index 19f8477..ab4656d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,41 @@ Contexts and API keys remain in the system keyring under the existing ## Development +### Package manager release publishing + +Stable releases automatically update `bucket/gorse-cli.json` on the `main` +branch of `gorse-io/scoop-bucket` through GoReleaser. The manifest includes +Windows amd64 and arm64 ZIP download URLs and SHA256 hashes. Existing standalone +release binaries remain available. Prerelease tags do not update the bucket. + +Before publishing, configure the `SCOOP_BUCKET_TOKEN` Actions secret in this +repository with a fine-grained personal access token restricted to +`gorse-io/scoop-bucket`, with **Contents: Read and write** permission. The token +must be allowed to push to the bucket's `main` branch (and approved by the +organization if required). The default `GITHUB_TOKEN` remains responsible for +uploading CLI release assets; it cannot write to the separate bucket repository. + +The same release also updates `Formula/gorse-cli.rb` on the `main` branch of +`gorse-io/homebrew-tap` for macOS arm64 and Linux amd64/arm64. Configure a second +Actions secret, `HOMEBREW_TAP_TOKEN`, restricted to that repository with +**Contents: Read and write** permission and access to push to `main`. +Prerelease tags do not update the tap either. Homebrew uses TAR.GZ archives; +Scoop uses ZIP archives, while standalone binaries remain unchanged. + +The Homebrew publisher uses GoReleaser's deprecated but still supported `brews` +configuration to update the existing Formula in place. Migrating the tap to +Casks and adding tap migration metadata is outside this change. + +Validate release artifacts locally without publishing: + +```sh +goreleaser release --snapshot --clean +``` + +`goreleaser check` reports the intentional `brews` deprecation as a nonzero +exit; snapshot generation validates both package manager outputs without +publishing. + ```sh go test ./... go vet ./...