Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1.54 KB
/
Copy pathMakefile
File metadata and controls
52 lines (41 loc) · 1.54 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
.PHONY: build test test-e2e fmt lint clean run release release-snapshot man
BINARY := emailable
PKG := .
PLUGIN := .claude-plugin/plugin.json
build:
go build -o bin/$(BINARY) $(PKG)
test:
go test -race -coverprofile=coverage.txt ./...
# Runs the built binary against the real API. Requires EMAILABLE_TEST_API_KEY
# set to a test key (test_...), which spends no credits.
test-e2e:
go test -tags e2e -count=1 -v ./e2e
fmt:
gofmt -w .
lint:
golangci-lint run ./...
clean:
rm -rf bin/ dist/
find . -type f -name 'coverage.txt' -delete
run:
go run $(PKG) $(ARGS)
# Cut a release: sync the plugin manifest version, commit, and tag.
# Usage: make release VERSION=1.2.3
# Pushing the tag triggers the GoReleaser workflow, which also verifies the
# tag matches plugin.json (see .github/workflows/release.yml).
release:
ifndef VERSION
$(error VERSION is required, e.g. make release VERSION=1.2.3)
endif
@echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$' || { echo "error: VERSION must be semver x.y.z (got '$(VERSION)')"; exit 1; }
@test -z "$$(git status --porcelain)" || { echo "error: working tree not clean; commit or stash first"; exit 1; }
@tmp=$$(mktemp) && sed -E 's/("version": *")[^"]*(")/\1$(VERSION)\2/' $(PLUGIN) > $$tmp && mv $$tmp $(PLUGIN)
@git add $(PLUGIN)
@git commit -m "Release v$(VERSION)"
@git tag -a v$(VERSION) -m "v$(VERSION)"
@echo "Tagged v$(VERSION). Push the commit and tag to release: git push --follow-tags"
release-snapshot:
goreleaser release --snapshot --clean
man: build
mkdir -p man
./bin/$(BINARY) man -o man