How to set up GoReleaser to push a brew tap to a different repo

1.6k views Asked by At

I'm looking to set up a github action script on a private github repo which pushes a release and brew tap to a separate public git repo. I've created a .gorelease.yml file and specified a brews section like this:

brews:
- name: myrepo
  goarm: 6
  github:
    owner: myrepo
    name: homebrew-myrepo
  homepage: "https://myrepo.com"

The .gorelease.yml file works fine and successfully builds the binaries. I've also specified a github token for the public repository in the github action, so that should work.

When I run the github action, I get this error:

   fatal: no tag exactly matches '38d505213e445a673a34812929ff858595e1a887'
   ⚠️ No tag found for commit 38d5052. Snapshot forced
   ...
   • signing artifacts        
      • pipe skipped              error=artifact signing is disabled
   • docker images            
      • pipe skipped              error=docker section is not configured
   • publishing               
      • pipe skipped              error=publishing is disabled
   • release succeeded after 159.12s

What I don't understand why the current git repo is relevant. Because I'm pushing to a separate repo, shouldn't this script be checking the tags on that repo (not the current one)? And even in this case, how would I automatically create a tag on every push?

1

There are 1 answers

0
erdaltsksn On BEST ANSWER

goreleaser uses the semver to figure out the versions so you have to add tag in the format of v1.2.4

git tag v1.2.4
git push --tags

.goreleaser.yml

brews:
  - github:
      owner: my-repo
      name: homebrew-myrepo
    folder: Formula
    homepage: https://github.com/my-repo/abc

Workflow file

    - name: GoReleaser
      uses: goreleaser/goreleaser-action@v2
      with:
        version: latest
        args: release --rm-dist
      env:
        GITHUB_TOKEN: ${{ secrets.GR_TOKEN }}

NOTE: Do not forget to create a new token and add it as a secret in the relevant repository.