Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup goreleaser to update homebrew #1121

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,17 @@ release:
# Default is `{{.Tag}}`
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"

# brews:
# We do not use the brew config, which is for taps, not core forumulas.
brews:
Copy link
Member

Choose a reason for hiding this comment

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

is there any way we can test this?

Copy link
Contributor Author

@baduker baduker Nov 22, 2023

Choose a reason for hiding this comment

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

As far as I'm concerned, I am not aware of a way to explicitly test brews section locally. However, I use this

goreleaser release --snapshot --clean --verbose

Running this command with the proposed changes should give you verbose output, including a section on homebrew tap formula. Speaking of which, it's called repository now as brews.tap is deprecated. To reproduce run goreleaser check and read https://goreleaser.com/deprecations#brewstap

Note: I need to comment out this section:

#signs:
#  - artifacts: checksum
#    args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]

As I don't have access to Env.GPG_FINGERPRINT and without this gpg complains and goreleaser fails locally.

Running the above command with the proposed changes in this PR, gives me the following (redacted for brevity):

[output shortened]

• homebrew tap formula
    • token type                                     type=github
    • calculating checksum for dist/exercism-0.0.0-SNAPSHOT-83a63ba-linux-armv6.tar.gz
    • guessing install                               install=[bin.install "exercism"]
    • calculating checksum for dist/exercism-0.0.0-SNAPSHOT-83a63ba-linux-x86_64.tar.gz
    • guessing install                               install=[bin.install "exercism"]
    • calculating checksum for dist/exercism-0.0.0-SNAPSHOT-83a63ba-darwin-x86_64.tar.gz
    • guessing install                               install=[bin.install "exercism"]
    • calculating checksum for dist/exercism-0.0.0-SNAPSHOT-83a63ba-linux-arm64.tar.gz
    • guessing install                               install=[bin.install "exercism"]
    • calculating checksum for dist/exercism-0.0.0-SNAPSHOT-83a63ba-darwin-arm64.tar.gz
    • guessing install                               install=[bin.install "exercism"]
    • writing                                        formula=dist/homebrew/Formula/exercism.rb
    • added new artifact                             name=exercism.rb type=Brew Tap path=dist/homebrew/Formula/exercism.rb

[output shortened]

This indicates that the brews section is being processed correctly and the actual versioned release should generate and publish a homebrew-tap recipe into a repository.

-
name: exercism
repository:
owner: exercism
name: homebrew-exercism
commit_author:
name: Exercism Bot
email: [email protected]
folder: Formula
homepage: "https://exercism.org/"
description: "Command-line tool to interact with exercism.io"
test: |
system "exercism version"
6 changes: 4 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ goreleaser --skip-publish --snapshot --clean
# Create a new tag on the main branch and push it
git tag -a "${TAG_NAME}" -m "Trying out GoReleaser"
git push origin "${TAG_NAME}"

# [TODO] Push to homebrew
```
Brew tap is now managed by `.goreleaser.yml` so no need to update it manually.
GoReleaser can generate and publish a homebrew-tap recipe into a repository
automatically. See [GoReleaser docs](https://goreleaser.com/customization/homebrew/)
for more details.

## Cut Release on GitHub

Expand Down