-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (54 loc) · 1.72 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
version := $(shell git tag --points-at $(git rev-parse HEAD) | grep "v\(.*\)" 2> /dev/null)
release_args := --user Wizcorp --repo terraform-provider-ncloud --tag $(version)
# Print out the list of known regions, zones, etc/
list-services:
@go run \
src/ncloud-products-list/main.go
.PHONY: generate-services
# Generate Services.md
generate-services:
@go run \
src/ncloud-products-list/main.go > Services.md
.PHONY: generate-services
# Build the provider
# CGO_ENABLED=0 must be set to run on Alpine
# See https://stackoverflow.com/a/36308464/262831
build:
CGO_ENABLED=0 go build \
-o build/terraform-provider-ncloud \
src/terraform-provider-ncloud/*.go
.PHONY: build
# Make a release for all supported platforms
release-all:
ifndef version
$(error usage: current commit is not tagged, please make sure to tag before releasing)
endif
git push --tags upstream master
github-release release $(release_args) \
--name $(version) \
--description $(version)
mmake release target=linux
mmake release target=darwin
mmake release target=windows
.PHONY: release-all
zipfile := terraform-provider-ncloud-$(version)-$(target).zip
# Make a release for a specific target platform
release:
ifndef target
$(error usage: mmake release target=(linux|darwin|windows))
endif
echo $(version)
ifndef version
$(error usage: current commit is not tagged, please make sure to tag before releasing)
endif
GOOS=$(target) mmake build
ifeq ($(OS),Windows_NT)
Compress-Archive -Path ./build/terraform-provider-ncloud -CompressionLevel Fastest -DestinationPath $(zipfile)
else
cd ./build && zip ../$(zipfile) ./terraform-provider-ncloud
endif
github-release upload $(release_args) \
--name $(zipfile) \
--file $(zipfile)
rm $(zipfile)
.PHONY: release