Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Homebrew tap support via goreleaser (#48)
* Add Homebrew tap support via goreleaser A Homebrew tap is a third-party git repo that contains a "formula" that homebrew can use to install some software not included in homebrew core. The repo is usually presumed to be on GitHub, and must be named something like '<owner>/homebrew-<tap name>' - in our case, 'homebrew-otel-cli'. It seems that goreleaser supports automatically creating a formula and then pushing it up to a third-party repo. In order to take advantage of this support, someone will need to create a repo suitable for hosting this, and generate the required credentials and pass them to goreleaser as an env variable (which can be a GitHub secret used in the actions workflow). Then, when goreleaser runs, it will push the latest formula to the configured repo and homebrew users can install it. As an end-user - presuming the repo is 'equinix-labs/homebrew-otel-cli', you would do something like this: ``` $ brew tap 'equinix-labs/otel-cli' $ brew install otel-cli ``` Note that while the repo *must* be named 'homebrew-otel-cli', users drop the 'homebrew-' prefix when adding the tap. I tested this by running: `goreleaser release --snapshot --skip-publish --rm-dist` and the following formula was output to `dist/otel-cli.rb`, which looks correct to me: ```ruby class OtelCli < Formula desc "OpenTelemetry command-line tool for sending events from shell scripts & similar environments" homepage "https://github.com/packethost/otel-cli" version "v0.0.4-next" license "Apache-2.0" bottle :unneeded on_macos do if Hardware::CPU.intel? url "https://github.com/packethost/otel-cli/releases/download/v0.0.3/otel-cli_v0.0.4-next_Darwin_x86_64.tar.gz" sha256 "fe6f51aa4ce8a3cb2e599d455fa36b2f553130fa850ad2fd0ad7ad1657820d1a" end if Hardware::CPU.arm? url "https://github.com/packethost/otel-cli/releases/download/v0.0.3/otel-cli_v0.0.4-next_Darwin_arm64.tar.gz" sha256 "e1f9ce6e736d3e9b2346728d83942cdce3277f0dcbc0af72eb992ceb71b6bb56" end end on_linux do if Hardware::CPU.intel? url "https://github.com/packethost/otel-cli/releases/download/v0.0.3/otel-cli_v0.0.4-next_Linux_x86_64.tar.gz" sha256 "23c919ccf087f5f093f87ed14fe57e47deb2d16fb2c0940d9f9d576074be4e18" end if Hardware::CPU.arm? && Hardware::CPU.is_64_bit? url "https://github.com/packethost/otel-cli/releases/download/v0.0.3/otel-cli_v0.0.4-next_Linux_arm64.tar.gz" sha256 "9d661508f6a0b121a0002ea05c2b361fb8bea14e9e448f76889a29c3d001d470" end end def install bin.install "otel-cli" end end ``` * update settings & reorder file Switched to point at equinix-labs instead of packethost. Switched publisher to myself. I think merging main reordered things so I've reordered the file. Switched to use GITHUB_TOKEN instead - is this bad? My guess is @ahayworth has a lot of tokens so has to be more careful? Signed-off-by: Amy Tobey <atobey@equinix.com> * disable skip_upload for now, to test Signed-off-by: Amy Tobey <atobey@equinix.com> * re-enable skip_upload Test succeeded :) equinix-labs/homebrew-otel-cli@5d44b32 Signed-off-by: Amy Tobey <atobey@equinix.com> * mention brew tap & packages in the README Signed-off-by: Amy Tobey <atobey@equinix.com> Co-authored-by: Amy Tobey <atobey@equinix.com>
- Loading branch information