Skip to content

Commit 5fdf001

Browse files
Thomas Strombergclaude
authored andcommitted
Add --version flag and make release workflow
- Add --version flag to display version information - Create make release workflow for creating version tags - Add Homebrew formula for packaging and distribution - Update formula test to use --version flag 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 59de9fb commit 5fdf001

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

Makefile

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
1010
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
1111
LDFLAGS := -X main.version=$(GIT_VERSION) -X main.commit=$(GIT_COMMIT) -X main.date=$(BUILD_DATE)
1212

13-
.PHONY: all build clean deps run app-bundle install install-darwin install-unix install-windows test
13+
.PHONY: all build clean deps run app-bundle install install-darwin install-unix install-windows test release
1414

1515
test:
1616
go test -race ./...
@@ -257,3 +257,35 @@ fix:
257257
exit $$exit_code
258258

259259
# END: lint-install .
260+
261+
# Release workflow - creates a new version tag
262+
# Usage: make release VERSION=v1.0.0
263+
release:
264+
@if [ -z "$(VERSION)" ]; then \
265+
echo "Error: VERSION is required. Usage: make release VERSION=v1.0.0"; \
266+
exit 1; \
267+
fi
268+
@echo "Creating release $(VERSION)..."
269+
@if ! echo "$(VERSION)" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$$'; then \
270+
echo "Error: VERSION must be in format vX.Y.Z (e.g., v1.0.0)"; \
271+
exit 1; \
272+
fi
273+
@if git rev-parse "$(VERSION)" >/dev/null 2>&1; then \
274+
echo "Error: Tag $(VERSION) already exists"; \
275+
exit 1; \
276+
fi
277+
@echo "Running tests..."
278+
@$(MAKE) test
279+
@echo "Running linters..."
280+
@$(MAKE) lint
281+
@echo "Checking for uncommitted changes..."
282+
@if [ -n "$$(git status --porcelain)" ]; then \
283+
echo "Error: Working directory has uncommitted changes"; \
284+
git status --short; \
285+
exit 1; \
286+
fi
287+
@echo "Creating and pushing tag $(VERSION)..."
288+
@git tag -a "$(VERSION)" -m "Release $(VERSION)"
289+
@git push origin "$(VERSION)"
290+
@echo "✓ Release $(VERSION) created and pushed successfully"
291+
@echo " View release at: https://github.com/codeGROOVE-dev/goose/releases/tag/$(VERSION)"

cmd/goose/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,27 @@ func main() {
117117
var targetUser string
118118
var noCache bool
119119
var debugMode bool
120+
var showVersion bool
120121
var updateInterval time.Duration
121122
var browserOpenDelay time.Duration
122123
var maxBrowserOpensMinute int
123124
var maxBrowserOpensDay int
124125
flag.StringVar(&targetUser, "user", "", "GitHub user to query PRs for (defaults to authenticated user)")
125126
flag.BoolVar(&noCache, "no-cache", false, "Bypass cache for debugging")
126127
flag.BoolVar(&debugMode, "debug", false, "Enable debug logging")
128+
flag.BoolVar(&showVersion, "version", false, "Show version information and exit")
127129
flag.DurationVar(&updateInterval, "interval", defaultUpdateInterval, "Update interval (e.g. 30s, 1m, 5m)")
128130
flag.DurationVar(&browserOpenDelay, "browser-delay", 1*time.Minute, "Minimum delay before opening PRs in browser after startup")
129131
flag.IntVar(&maxBrowserOpensMinute, "browser-max-per-minute", 2, "Maximum browser windows to open per minute")
130132
flag.IntVar(&maxBrowserOpensDay, "browser-max-per-day", defaultMaxBrowserOpensDay, "Maximum browser windows to open per day")
131133
flag.Parse()
132134

135+
// Handle version flag
136+
if showVersion {
137+
fmt.Printf("goose version %s\ncommit: %s\nbuilt: %s\n", version, commit, date)
138+
os.Exit(0)
139+
}
140+
133141
// Validate target user if provided
134142
if targetUser != "" {
135143
if err := validateGitHubUsername(targetUser); err != nil {

goose.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class Goose < Formula
2+
desc "Menubar app for GitHub pull request tracking and notifications"
3+
homepage "https://github.com/codeGROOVE-dev/goose"
4+
url "https://github.com/ready-to-review/goose.git",
5+
tag: "v3.7.1",
6+
revision: "920467c86e2123db4d47503de341bfb5aca79b42"
7+
license "GPL-3.0-only"
8+
head "https://github.com/ready-to-review/goose.git", branch: "main"
9+
10+
depends_on "go" => :build
11+
depends_on "gh"
12+
13+
def install
14+
ldflags = %W[
15+
-X main.version=#{version}
16+
-X main.commit=#{Utils.git_short_head}
17+
-X main.date=#{time.iso8601}
18+
]
19+
20+
system "go", "build", *std_go_args(ldflags:, output: bin/"goose"), "./cmd/goose"
21+
end
22+
23+
test do
24+
output = shell_output("#{bin}/goose --version")
25+
assert_match version.to_s, output
26+
end
27+
end

0 commit comments

Comments
 (0)