-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (52 loc) · 1.03 KB
/
Makefile
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
APP_NAME=template-go
BINARY=tmp/$(APP_NAME)
DEBUG=false
.PHONY: default
default: clean install-tools build
.PHONY: clean
clean:
@rm -rf dist/ tmp/ node_modules/
@find . -type d -empty -delete
.PHONY: download
download:
@go mod tidy
@go mod download
.PHONY: install-tools
install-tools: download
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
@lefthook install
@bun install
.PHONY: update
update:
@go get -u ./...
.PHONY: build
build:
@go build -tags='dev' -o $(BINARY) ./cmd/$(APP_NAME)
.PHONY: run
run:
@\
bash -c "if [ "$(DEBUG)" = "true" ]; then \
echo "rebuild"; \
else \
$(BINARY); \
fi"
.PHONY: dev
dev:
@\
wgo -file .go go mod tidy :: \
wgo -file .go make -s build :: \
wgo -file $(BINARY) make -s run
.PHONY: debug
debug:
@make DEBUG=true dev
.PHONY: snapshot
snapshot:
@goreleaser release --snapshot --clean
TAG=v$(shell cat .version)
.PHONY: git-tag
git-tag:
@git tag -f -a $(TAG) -m "Release $(TAG)"
@git push origin $(TAG)
.PHONY: push-tag
push-tag:
@git push origin $(TAG)