-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (56 loc) · 2.24 KB
/
Makefile
File metadata and controls
67 lines (56 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
BINARY_NAME=notesmd-cli
install-hooks:
git config core.hooksPath .githooks
build-all:
GOOS=darwin GOARCH=amd64 go build -o bin/darwin/${BINARY_NAME}
GOOS=linux GOARCH=amd64 go build -o bin/linux/${BINARY_NAME}
GOOS=windows GOARCH=amd64 go build -o bin/windows/${BINARY_NAME}.exe
clean-all:
go clean
rm bin/darwin/${BINARY_NAME}
rm bin/linux/${BINARY_NAME}
rm bin/windows/${BINARY_NAME}.exe
test:
go test ./...
test-search-content:
go test ./pkg/actions -run TestSearchNotesContent -v
test-coverage:
go test ./... -coverprofile=coverage.out
update-usage-image:
freeze --execute "go run main.go --help" --theme dracula --output docs/usage.png
# Release automation
# Usage: make release VERSION=v0.2.2
release:
ifndef VERSION
$(error VERSION is not set. Usage: make release VERSION=v0.2.2)
endif
@echo "Starting release process for $(VERSION)..."
@# Update version in root.go
@sed -i '' 's/Version: "v[0-9]*\.[0-9]*\.[0-9]*"/Version: "$(VERSION)"/' cmd/root.go
@echo "✓ Updated version in root.go to $(VERSION)"
@# Create screenshot
@$(MAKE) update-usage-image
@echo "✓ Created usage screenshot"
@# Build all binaries
@$(MAKE) build-all
@echo "✓ Built binaries for all platforms"
@# Git operations
@git add cmd/root.go docs/usage.png
@git commit -m "chore: bump version to $(VERSION)"
@git tag $(VERSION)
@git push origin main
@git push origin $(VERSION)
@echo "✓ Release $(VERSION) complete!"
# Quick release (interactive version bump)
release-patch:
@$(eval CURRENT_VERSION := $(shell grep 'Version:' cmd/root.go | sed 's/.*"v\([0-9]*\.[0-9]*\.[0-9]*\)".*/\1/'))
@$(eval NEW_VERSION := $(shell echo $(CURRENT_VERSION) | awk -F. '{print "v" $$1 "." $$2 "." $$3+1}'))
@$(MAKE) release VERSION=$(NEW_VERSION)
release-minor:
@$(eval CURRENT_VERSION := $(shell grep 'Version:' cmd/root.go | sed 's/.*"v\([0-9]*\.[0-9]*\.[0-9]*\)".*/\1/'))
@$(eval NEW_VERSION := $(shell echo $(CURRENT_VERSION) | awk -F. '{print "v" $$1 "." $$2+1 ".0"}'))
@$(MAKE) release VERSION=$(NEW_VERSION)
release-major:
@$(eval CURRENT_VERSION := $(shell grep 'Version:' cmd/root.go | sed 's/.*"v\([0-9]*\.[0-9]*\.[0-9]*\)".*/\1/'))
@$(eval NEW_VERSION := $(shell echo $(CURRENT_VERSION) | awk -F. '{print "v" $$1+1 ".0.0"}'))
@$(MAKE) release VERSION=$(NEW_VERSION)