Skip to content

ci: publish the Homebrew formula to skyoo2003/homebrew-tap - #121

Merged
skyoo2003 merged 3 commits into
mainfrom
chore/homebrew-tap-publish
Jul 30, 2026
Merged

ci: publish the Homebrew formula to skyoo2003/homebrew-tap#121
skyoo2003 merged 3 commits into
mainfrom
chore/homebrew-tap-publish

Conversation

@skyoo2003

Copy link
Copy Markdown
Owner

Why

brew install skyoo2003/tap/devcloud does not work today — the tap only carries kvs. The release already builds every archive a formula needs, so this only adds the publishing step.

What

  • .goreleaser.yaml: brews section writing Formula/devcloud.rb to skyoo2003/homebrew-tap.
  • release.yml: mint the cross-repo token with actions/create-github-app-token, scoped to homebrew-tap only and expiring with the job — no long-lived PAT (see Drop QEMU from release, retire GH_PAT, close review gaps kvs#228). Skipped on a dry run, which publishes nothing.
  • archives: format:formats:, deprecated since GoReleaser v2.6.

Requires repository secrets TAP_APP_ID and TAP_APP_PRIVATE_KEY.

Verified locally

  • goreleaser release --snapshot --skip=docker generates dist/homebrew/devcloud.rb with the correct darwin/linux amd64+arm64 matrix, and succeeds without HOMEBREW_TAP_TOKEN — so the dry_run: true path stays green without the secret.
  • ruby -c on the generated formula: syntax OK.
  • The test do assertion matches reality: devcloud -h prints the -config flag and exits 0. It deliberately does not start the server — devcloud has no subcommands, so any other invocation would hang the test.

Note

brews is deprecated (removal in GoReleaser v3); homebrew_casks is not a drop-in replacement because casks are macOS-only. At v3 this moves to a generator in the tap repository.

devcloud was never available via `brew install`, even though the release
already builds every archive the formula needs. Add a `brews` section that
writes Formula/devcloud.rb into skyoo2003/homebrew-tap on each tag.

The tap lives in another repository, so the job's own GITHUB_TOKEN cannot
write to it. Instead of a long-lived PAT, mint a GitHub App installation
token that is scoped to homebrew-tap alone and expires with the job. The
dry run skips minting it, since nothing is published there.

The formula test only asserts the flag usage text: devcloud is a
long-running server with no subcommands, so anything else would hang.

While here, migrate archives to `formats:`, which `goreleaser check` has
flagged as deprecated since v2.6.
@sourcery-ai

sourcery-ai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR updates the GoReleaser configuration and the release GitHub Actions workflow to publish a Homebrew formula for devcloud to the skyoo2003/homebrew-tap repository, using a short-lived GitHub App token and modern archive configuration options.

File-Level Changes

Change Details Files
Update GoReleaser archive configuration to use the non-deprecated formats field.
  • Replace format: tar.gz with formats: [ tar.gz ] in the devcloud archive definition.
  • Replace Windows-specific format: zip override with formats: [ zip ].
  • Keep existing archive file inclusions and checksum settings unchanged.
.goreleaser.yaml
Configure GoReleaser to generate and publish a Homebrew formula for devcloud into the external skyoo2003/homebrew-tap repository.
  • Add a brews section targeting the devcloud build ID.
  • Configure the Homebrew tap repository owner, name, and token environment variable.
  • Set formula metadata including homepage, description, and license.
  • Define install stanza to install the devcloud binary.
  • Add a non-blocking test that asserts -config appears in devcloud -h output.
.goreleaser.yaml
Extend the release workflow to mint a short-lived GitHub App token for the Homebrew tap and pass it to GoReleaser.
  • Add a Mint a Homebrew tap token step using actions/create-github-app-token conditioned on not being a dry run.
  • Scope the app token to the skyoo2003/homebrew-tap repository using repo-specific app credentials.
  • Export the generated token as HOMEBREW_TAP_TOKEN in the GoReleaser step environment.
  • Leave dry-run executions unchanged so they do not require the tap token or publish the formula.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the ci CI/CD workflows and scripts label Jul 30, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The tap repository owner/name (skyoo2003/homebrew-tap) is hardcoded in both .goreleaser.yaml and the workflow; consider centralizing these values (e.g., via env vars or workflow inputs) to avoid drift if they ever change.
  • In the release workflow, HOMEBREW_TAP_TOKEN is always set from steps.tap_token.outputs.token even when the minting step is skipped on dry runs; if GoReleaser ever starts validating this token, you may want to guard the env assignment with the same dry_run condition or provide a safe default.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The tap repository owner/name (`skyoo2003/homebrew-tap`) is hardcoded in both `.goreleaser.yaml` and the workflow; consider centralizing these values (e.g., via env vars or workflow inputs) to avoid drift if they ever change.
- In the release workflow, `HOMEBREW_TAP_TOKEN` is always set from `steps.tap_token.outputs.token` even when the minting step is skipped on dry runs; if GoReleaser ever starts validating this token, you may want to guard the env assignment with the same `dry_run` condition or provide a safe default.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

The tap owner and repository name were spelled out in both .goreleaser.yaml
and the release workflow, so a move would have to be caught in two places.
Declare them once as workflow-level env vars -- the owner from
github.repository_owner -- and let both the token-minting step and the brews
section read them.

HOMEBREW_TAP_TOKEN keeps its unconditional assignment: the homebrew pipe
renders the formula even under --snapshot, and an unset variable fails the
template outright rather than resolving empty. A dry run gets a placeholder
instead, which nothing ever uses because --snapshot publishes nothing.
@skyoo2003
skyoo2003 merged commit 7b97a11 into main Jul 30, 2026
7 checks passed
@skyoo2003
skyoo2003 deleted the chore/homebrew-tap-publish branch July 30, 2026 16:25
skyoo2003 added a commit to skyoo2003/homebrew-tap that referenced this pull request Jul 30, 2026
Both projects are only now wired up to publish here (skyoo2003/acor#181,
skyoo2003/devcloud#121), so their current releases would otherwise stay
uninstallable until the next tag. Every sha256 comes from the CHECKSUMS
asset of the published release, not from a local build.

The files match GoReleaser's own template byte for byte apart from the
version, URLs and checksums, so the first automated release overwrites them
with a diff of nothing else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD workflows and scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant