-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 1.59 KB
/
Makefile
File metadata and controls
62 lines (48 loc) · 1.59 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
.PHONY: build test clean install lint fmt release release-tag release-publish clean-release verify
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)"
build:
CGO_ENABLED=0 go build $(LDFLAGS) -o bin/mailcli ./cmd/mailcli
test:
go test -v ./...
install: build
cp bin/mailcli /usr/local/bin/
clean:
rm -rf bin/
lint:
golangci-lint run --config .golangci.yml
fmt:
go fmt ./...
mod:
go mod tidy
go mod verify
# Release targets
RELEASE_VERSION ?= $(VERSION)
release:
@echo "Building release $(RELEASE_VERSION)..."
@./scripts/release.sh $(RELEASE_VERSION)
release-tag:
@if [ -z "$(RELEASE_VERSION)" ]; then \
echo "Error: RELEASE_VERSION must be set"; \
echo "Usage: make release-tag RELEASE_VERSION=v1.0.0"; \
exit 1; \
fi
@echo "Creating git tag $(RELEASE_VERSION)..."
@git tag -a $(RELEASE_VERSION) -m "Release $(RELEASE_VERSION)"
@echo "Tag $(RELEASE_VERSION) created. Push with:"
@echo " git push origin $(RELEASE_VERSION)"
release-publish: release
@if ! command -v gh >/dev/null 2>&1; then \
echo "Error: gh CLI not found. Install from https://cli.github.com/"; \
exit 1; \
fi
@echo "Creating GitHub release $(RELEASE_VERSION)..."
@gh release create $(RELEASE_VERSION) release/* --notes-file release/release-notes.md
clean-release:
@echo "Cleaning release artifacts..."
@rm -rf release/ bin/dist/
verify: build test
@echo "Running verification..."
@echo "✓ Build successful"
@echo "✓ All tests passed"
@echo "✓ Verification complete"