-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
57 lines (46 loc) · 1.22 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
PROJECT_BIN_NAME=local-chart-version
PROJECT_NAME=helm-$(PROJECT_BIN_NAME)
HELM_HOME ?= $(shell helm home)
VERSION ?= $(shell sed -n -e 's/version:[ "]*\([^"]*\).*/\1/p' plugin.yaml)
pkgs = $(shell go list ./... | grep -v /vendor/ | grep -v /test/)
.PHONY: clean
clean:
rm -rf $(PROJECT_BIN_NAME) ./dist
HAS_GIT := $(shell command -v git;)
HAS_GORELEASER := $(shell command -v goreleaser;)
.PHONY: show-version
show-version:
@echo $(VERSION)
.PHONY: gendoc
gendoc: build
mkdir -p docs
./$(PROJECT_BIN_NAME) generate-documentation
make clean --always-make
.PHONY: build
build: test
go build -v -o $(PROJECT_BIN_NAME)
.PHONY: test
test:
go test ./...
.PHONY: build-cross
build-cross: clean test gendoc
ifndef HAS_GORELEASER
$(error You must install goreleaser)
endif
goreleaser --snapshot
.PHONY: install
install: build
mkdir -p $(HELM_HOME)/plugins/$(PROJECT_NAME)
cp $(PROJECT_BIN_NAME) $(HELM_HOME)/plugins/$(PROJECT_NAME)/
cp plugin.yaml $(HELM_HOME)/plugins/$(PROJECT_NAME)/
.PHONY: release
release: clean test gendoc
ifndef HAS_GIT
$(error You must install Git)
endif
ifndef HAS_GORELEASER
$(error You must install goreleaser)
endif
git tag -a v$(VERSION) -m "release v$(VERSION)"
git push origin v$(VERSION)
goreleaser