-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (58 loc) · 2.36 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
66
67
68
69
70
71
72
export CGO_ENABLED:=0
VERSION=$(shell git describe --tags --match=v* --always)
SEMVER=$(shell git describe --tags --match=v* --always | cut -c 2-)
.PHONY: all
all: build test vet fmt
.PHONY: build
build: clean bin/terraform-provider-cue
bin/terraform-provider-cue:
@go build -o $@ github.com/poseidon/terraform-provider-cue
.PHONY: test
test:
@go test ./... -cover
.PHONY: vet
vet:
@go vet -all ./...
.PHONY: fmt
fmt:
@test -z $$(go fmt ./...)
.PHONY: clean
clean:
@rm -rf bin
@rm -rf _output
.PHONY: release
release: \
clean \
_output/plugin-linux-amd64.zip \
_output/plugin-linux-arm64.zip \
_output/plugin-darwin-amd64.zip \
_output/plugin-darwin-arm64.zip \
_output/plugin-windows-amd64.zip
release-test: OS_ARCH=$(shell go env GOOS)_$(shell go env GOARCH)
release-test: DEST=$(HOME)/.terraform.d/plugins/terraform.localhost/poseidon/cue/$(SEMVER)/$(OS_ARCH)
release-test: NAME=_output/terraform-provider-cue_$(SEMVER)_$(OS_ARCH)
release-test:
@mkdir -p $(DEST)
cp $(NAME)/* $(DEST)
_output/plugin-%.zip: NAME=terraform-provider-cue_$(SEMVER)_$(subst -,_,$*)
_output/plugin-%.zip: DEST=_output/$(NAME)
_output/plugin-%.zip: LOCAL=$(HOME)/.terraform.d/plugins/terraform.localhost/poseidon/cue/$(SEMVER)
_output/plugin-%.zip: _output/%/terraform-provider-cue
@mkdir -p $(DEST)
@cp _output/$*/terraform-provider-cue $(DEST)/terraform-provider-cue_$(VERSION)
@zip -j $(DEST).zip $(DEST)/terraform-provider-cue_$(VERSION)
@mkdir -p $(LOCAL)/$(subst -,_,$*)
@cp _output/$*/terraform-provider-cue $(LOCAL)/$(subst -,_,$*)/terraform-provider-cue_$(VERSION)
_output/linux-amd64/terraform-provider-cue: GOARGS = GOOS=linux GOARCH=amd64
_output/linux-arm64/terraform-provider-cue: GOARGS = GOOS=linux GOARCH=arm64
_output/darwin-amd64/terraform-provider-cue: GOARGS = GOOS=darwin GOARCH=amd64
_output/darwin-arm64/terraform-provider-cue: GOARGS = GOOS=darwin GOARCH=arm64
_output/windows-amd64/terraform-provider-cue: GOARGS = GOOS=windows GOARCH=amd64
_output/%/terraform-provider-cue:
$(GOARGS) go build -o $@ github.com/poseidon/terraform-provider-cue
release-sign:
cd _output; sha256sum *.zip > terraform-provider-cue_$(SEMVER)_SHA256SUMS
gpg --default-key 0x8F515AD1602065C8 --detach-sign _output/terraform-provider-cue_$(SEMVER)_SHA256SUMS
release-verify: NAME=_output/terraform-provider-cue
release-verify:
gpg --verify $(NAME)_$(SEMVER)_SHA256SUMS.sig $(NAME)_$(SEMVER)_SHA256SUMS