From 64b1bf08113ba2e57ef5655c43582fbf73288c26 Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:03:05 +0530 Subject: [PATCH 1/9] feat: add GoReleaser configuration and update README for Homebrew release --- .github/workflows/release.yml | 33 ++++++++++++++++++ .goreleaser.yaml | 66 +++++++++++++++++++++++++++++++++++ README.md | 36 +++++++++++++++++-- Taskfile.yml | 2 +- 4 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fbe5f97 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v7 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..2aa1bdd --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,66 @@ +version: 2 + +project_name: brew-potato + +before: + hooks: + - go mod tidy + +builds: + - id: brew-ui-darwin + main: ./main.go + binary: brew-potato + env: + - CGO_ENABLED=0 + goos: + - darwin + goarch: + - amd64 + - arm64 + - id: brew-ui-linux + main: ./main.go + binary: brew-potato + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + +archives: + - id: brew-ui-darwin-archive + ids: + - brew-ui-darwin + formats: + - tar.gz + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + - id: brew-ui-linux-archive + ids: + - brew-ui-linux + formats: + - tar.gz + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + +checksum: + name_template: checksums.txt + +release: + github: + owner: mrSamDev + name: brew-ui-potato + prerelease: auto + +homebrew_casks: + - name: brew-potato + ids: + - brew-ui-darwin-archive + binaries: + - brew-potato + homepage: "https://github.com/mrSamDev/brew-ui-potato" + description: "Terminal UI for managing Homebrew packages." + directory: Casks + repository: + owner: mrSamDev + name: homebrew-tap + token: "{{ .Env.GITHUB_TOKEN }}" diff --git a/README.md b/README.md index c89d9a6..34e46f2 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,41 @@ brew-ui/ └── go.sum ``` -## Next Steps +## Release With Homebrew (GoReleaser) -[GoReleaser](https://github.com/goreleaser/goreleaser) can publish brew-potato as an actual Homebrew formula so anyone can install it with `brew install`. It handles cross-compilation, GitHub release assets, and writing the formula to a tap repo automatically. +This repo is configured for GoReleaser v2 (`.goreleaser.yaml`) and GitHub Actions (`.github/workflows/release.yml`) to: + +- build release binaries for macOS and Linux +- create GitHub release assets + checksums +- publish a Homebrew cask into a tap repo (`mrSamDev/homebrew-tap`) + +### One-time setup + +1. Create the tap repo (or change `.goreleaser.yaml` to your own): + - `mrSamDev/homebrew-tap` +2. Add GitHub secret in this repo: + - `GH_PAT`: a Personal Access Token with `repo` scope and write access to the tap repo + +### Create a release + +Version comes from the Git tag you push (for example `v0.1.0`): + +```sh +git tag v0.1.0 +git push origin v0.1.0 +``` + +That tag triggers the `Release` workflow and publishes: + +- GitHub release artifacts in `mrSamDev/brew-ui-potato` +- `Casks/brew-potato.rb` in `mrSamDev/homebrew-tap` + +### Install via Homebrew + +```sh +brew tap mrSamDev/homebrew-tap +brew install --cask brew-potato +``` ## Keybindings diff --git a/Taskfile.yml b/Taskfile.yml index a2ac666..a9f6d07 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,7 +6,7 @@ tasks: build: desc: Build the binary cmds: - - go build -o bin/brew-ui ./main.go + - go build -o bin/brew-potato ./main.go test: desc: Run all tests From c03ba9ba49f65f58a40f8a8c2af178d615473010 Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:04:56 +0530 Subject: [PATCH 2/9] fix: update GitHub token secret reference in release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbe5f97..3cf045d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,4 +30,4 @@ jobs: version: "~> v2" args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6da1e0517578f28c80830a2287f043c833af98fe Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:12:25 +0530 Subject: [PATCH 3/9] fix: update references from brew-ui-potato to brew-potato across the project --- .goreleaser.yaml | 4 ++-- README.md | 5 ++--- go.mod | 2 +- internal/brew/brew_test.go | 2 +- internal/ui/keys.go | 2 +- internal/ui/model.go | 2 +- internal/ui/model_test.go | 4 +--- main.go | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2aa1bdd..5d6e8c5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -48,7 +48,7 @@ checksum: release: github: owner: mrSamDev - name: brew-ui-potato + name: brew-potato prerelease: auto homebrew_casks: @@ -57,7 +57,7 @@ homebrew_casks: - brew-ui-darwin-archive binaries: - brew-potato - homepage: "https://github.com/mrSamDev/brew-ui-potato" + homepage: "https://github.com/mrSamDev/brew-potato" description: "Terminal UI for managing Homebrew packages." directory: Casks repository: diff --git a/README.md b/README.md index 34e46f2..67c4b99 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,7 @@ This repo is configured for GoReleaser v2 (`.goreleaser.yaml`) and GitHub Action 1. Create the tap repo (or change `.goreleaser.yaml` to your own): - `mrSamDev/homebrew-tap` -2. Add GitHub secret in this repo: - - `GH_PAT`: a Personal Access Token with `repo` scope and write access to the tap repo + ### Create a release @@ -91,7 +90,7 @@ git push origin v0.1.0 That tag triggers the `Release` workflow and publishes: -- GitHub release artifacts in `mrSamDev/brew-ui-potato` +- GitHub release artifacts in `mrSamDev/brew-potato` - `Casks/brew-potato.rb` in `mrSamDev/homebrew-tap` ### Install via Homebrew diff --git a/go.mod b/go.mod index 983f4b7..eb4873a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/mrSamDev/brew-ui-potato +module github.com/mrSamDev/brew-potato go 1.24.4 diff --git a/internal/brew/brew_test.go b/internal/brew/brew_test.go index ee12a68..cbdaec2 100644 --- a/internal/brew/brew_test.go +++ b/internal/brew/brew_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/mrSamDev/brew-ui-potato/internal/brew" + "github.com/mrSamDev/brew-potato/internal/brew" ) // brewJSONMultiple contains four formulae that exercise all filter paths: diff --git a/internal/ui/keys.go b/internal/ui/keys.go index f10472b..aa0b226 100644 --- a/internal/ui/keys.go +++ b/internal/ui/keys.go @@ -3,7 +3,7 @@ package ui import ( tea "charm.land/bubbletea/v2" - "github.com/mrSamDev/brew-ui-potato/internal/brew" + "github.com/mrSamDev/brew-potato/internal/brew" ) func (m Model) handleKey(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { diff --git a/internal/ui/model.go b/internal/ui/model.go index 38fec82..f51668b 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -5,7 +5,7 @@ import ( "charm.land/bubbles/v2/table" tea "charm.land/bubbletea/v2" - "github.com/mrSamDev/brew-ui-potato/internal/brew" + "github.com/mrSamDev/brew-potato/internal/brew" ) const ( diff --git a/internal/ui/model_test.go b/internal/ui/model_test.go index ff8e883..cfd07db 100644 --- a/internal/ui/model_test.go +++ b/internal/ui/model_test.go @@ -8,7 +8,7 @@ import ( "charm.land/bubbles/v2/table" tea "charm.land/bubbletea/v2" - "github.com/mrSamDev/brew-ui-potato/internal/brew" + "github.com/mrSamDev/brew-potato/internal/brew" ) var testPkgs = []brew.Package{ @@ -49,7 +49,6 @@ func mustModel(t *testing.T, m tea.Model) Model { return model } - func TestInit_returnsCmd(t *testing.T) { m := newTestModel(testPkgs) m.isInitialLoading = true @@ -176,4 +175,3 @@ func TestUpdate_uninstallDone_failure(t *testing.T) { t.Error("isLoading should be false after uninstall failure") } } - diff --git a/main.go b/main.go index e91e6df..d09020b 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( tea "charm.land/bubbletea/v2" - "github.com/mrSamDev/brew-ui-potato/internal/ui" + "github.com/mrSamDev/brew-potato/internal/ui" ) func main() { From 1d1bcb72e8c5d059c9ffdcb3e949d8c25a0a0726 Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:14:44 +0530 Subject: [PATCH 4/9] feat: add test job to release workflow for improved CI process --- .github/workflows/release.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3cf045d..dc54d43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,18 +10,38 @@ permissions: contents: write jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Vet + run: go vet ./... + + - name: Test + run: go test -race ./... + goreleaser: + needs: test runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version-file: go.mod + cache: true - name: Run GoReleaser uses: goreleaser/goreleaser-action@v7 @@ -30,4 +50,4 @@ jobs: version: "~> v2" args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 13cd7ed0c2bd7fbaea055fe4a20fb0695360eaef Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:27:59 +0530 Subject: [PATCH 5/9] fix: update GoReleaser job environment and GitHub token reference in release workflow --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc54d43..7355735 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,9 @@ jobs: goreleaser: needs: test runs-on: ubuntu-latest + environment: prod # 👈 Set environment + runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 @@ -50,4 +53,4 @@ jobs: version: "~> v2" args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} \ No newline at end of file From 5c5d0e631dedd6e498388a5137c2583aa3fd1f9a Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:28:48 +0530 Subject: [PATCH 6/9] fix: remove duplicate runs-on declaration in goreleaser job --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7355735..a9911c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: goreleaser: needs: test runs-on: ubuntu-latest - environment: prod # 👈 Set environment + environment: prod runs-on: ubuntu-latest steps: From 09ccc5d2ad8125cd07ab4832f296706469c94ff1 Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:29:39 +0530 Subject: [PATCH 7/9] fix: remove redundant runs-on declaration in goreleaser job --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9911c3..28e2cc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,6 @@ jobs: needs: test runs-on: ubuntu-latest environment: prod - runs-on: ubuntu-latest steps: - name: Checkout From 4af885f47e1a6588551001e40a5e6362e83c6bbe Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:38:12 +0530 Subject: [PATCH 8/9] fix: clean up GoReleaser configuration and remove unused build definitions --- .github/workflows/release.yml | 3 +- .goreleaser.yaml | 55 ++++++++++++----------------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28e2cc7..0c52fdc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ permissions: jobs: test: runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 @@ -37,7 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5d6e8c5..9edeb6e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,5 +1,3 @@ -version: 2 - project_name: brew-potato before: @@ -7,60 +5,43 @@ before: - go mod tidy builds: - - id: brew-ui-darwin - main: ./main.go + - id: brew-potato + main: . binary: brew-potato - env: - - CGO_ENABLED=0 goos: - darwin - goarch: - - amd64 - - arm64 - - id: brew-ui-linux - main: ./main.go - binary: brew-potato - env: - - CGO_ENABLED=0 - goos: - linux goarch: - amd64 - arm64 archives: - - id: brew-ui-darwin-archive - ids: - - brew-ui-darwin - formats: - - tar.gz - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" - - id: brew-ui-linux-archive - ids: - - brew-ui-linux - formats: - - tar.gz - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + - format: tar.gz checksum: - name_template: checksums.txt + name_template: "checksums.txt" release: github: owner: mrSamDev name: brew-potato - prerelease: auto -homebrew_casks: +brews: - name: brew-potato - ids: - - brew-ui-darwin-archive - binaries: - - brew-potato - homepage: "https://github.com/mrSamDev/brew-potato" - description: "Terminal UI for managing Homebrew packages." - directory: Casks + homepage: https://github.com/mrSamDev/brew-potato + description: A cute TUI for managing Homebrew apps + license: MIT + repository: owner: mrSamDev name: homebrew-tap token: "{{ .Env.GITHUB_TOKEN }}" + + commit_author: + name: mrSamDev + email: dev.sijo.sam@gmail.com + + directory: Formula + + install: | + bin.install "brew-potato" \ No newline at end of file From 0119b47ab0623a40298d8c48703da5b65419e49a Mon Sep 17 00:00:00 2001 From: mrsamdev Date: Mon, 2 Mar 2026 18:44:22 +0530 Subject: [PATCH 9/9] docs: update installation instructions for Homebrew in README and add install section in index.html --- README.md | 30 +----------------------------- docs/index.html | 9 +++++++++ 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 67c4b99..96248ae 100644 --- a/README.md +++ b/README.md @@ -65,39 +65,11 @@ brew-ui/ └── go.sum ``` -## Release With Homebrew (GoReleaser) - -This repo is configured for GoReleaser v2 (`.goreleaser.yaml`) and GitHub Actions (`.github/workflows/release.yml`) to: - -- build release binaries for macOS and Linux -- create GitHub release assets + checksums -- publish a Homebrew cask into a tap repo (`mrSamDev/homebrew-tap`) - -### One-time setup - -1. Create the tap repo (or change `.goreleaser.yaml` to your own): - - `mrSamDev/homebrew-tap` - - -### Create a release - -Version comes from the Git tag you push (for example `v0.1.0`): - -```sh -git tag v0.1.0 -git push origin v0.1.0 -``` - -That tag triggers the `Release` workflow and publishes: - -- GitHub release artifacts in `mrSamDev/brew-potato` -- `Casks/brew-potato.rb` in `mrSamDev/homebrew-tap` ### Install via Homebrew ```sh -brew tap mrSamDev/homebrew-tap -brew install --cask brew-potato +brew install mrSamDev/tap/brew-potato ``` ## Keybindings diff --git a/docs/index.html b/docs/index.html index 123c66d..bd38dbb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -287,6 +287,15 @@ + +
+ +
+
# install with Homebrew
+
brew install mrSamDev/tap/brew-potato
+
+
+