forked from eicnix/helm-opa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (30 loc) · 1.08 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
HELM_HOME ?= $(shell helm home)
HELM_PLUGIN_DIR ?= $(HELM_HOME)/plugins/helm-opa
HAS_DEP := $(shell command -v DEP;)
VERSION := $(shell sed -n -e 's/version:[ "]*\([^"]*\).*/\1/p' plugin.yaml)
DIST := $(CURDIR)/_dist
LDFLAGS := "-X main.version=${VERSION}"
.PHONY: install
install: bootstrap build
cp opa $(HELM_PLUGIN_DIR)
cp plugin.yaml $(HELM_PLUGIN_DIR)
.PHONY: hookInstall
hookInstall: bootstrap build
.PHONY: build
build:
go build -o opa -ldflags $(LDFLAGS) ./main.go
.PHONY: dist
dist:
mkdir -p $(DIST)
GOOS=linux GOARCH=amd64 go build -o opa -ldflags $(LDFLAGS) ./main.go
tar -zcvf $(DIST)/helm-opa-linux-$(VERSION).tgz opa README.md LICENSE.txt plugin.yaml
GOOS=darwin GOARCH=amd64 go build -o opa -ldflags $(LDFLAGS) ./main.go
tar -zcvf $(DIST)/helm-opa-macos-$(VERSION).tgz opa README.md LICENSE.txt plugin.yaml
GOOS=windows GOARCH=amd64 go build -o opa.exe -ldflags $(LDFLAGS) ./main.go
tar -zcvf $(DIST)/helm-opa-windows-$(VERSION).tgz opa.exe README.md LICENSE.txt plugin.yaml
.PHONY: bootstrap
bootstrap:
ifndef HAS_DEP
go get -u github.com/golang/dep/cmd/dep
endif
dep ensure