Skip to content

Instantly share code, notes, and snippets.

@jftuga
Created June 10, 2024 11:40
Show Gist options
  • Save jftuga/ee3f132ff315fdc1d1459256c16557c2 to your computer and use it in GitHub Desktop.
Save jftuga/ee3f132ff315fdc1d1459256c16557c2 to your computer and use it in GitHub Desktop.
GoReleaser and Homebrew setup

CONFIGURING GORELEASER TO BUILD HOMEBREW BINARIES

In .github/workflows/release.yml file:

      - name: run GoReleaser
        uses: goreleaser/goreleaser-action@v6
        env:
          HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          args: release --clean

In .goreleaser.yml file:

brews:
  - name: SomePgm
    repository:
      owner: MyUser
      name: homebrew-tap
      token: "{{ .Env.HOMEBREW_TOKEN }}"
    commit_author:
      name: MyUser
      email: MyUser@users.noreply.github.com
    homepage: https://github.com/MyUser/MyRepo
    description: "a cli program that does something"
    test: system "#{bin}/SomePgm -v"
    install: bin.install "SomePgm"

GitHub Project Settings

  • click on repo Settings
  • on the left side, click on Secrets and Variables and then Actions (which is hidden until you click Secrets and Variables)
  • on the right side, clicked the Secrets tab
  • click the New Repository Secret button
  • add a HOMEBREW_TOKEN token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment