-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
60 lines (51 loc) · 1.65 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
VERSION := $(shell git describe --always)
clean:
rm -rf target
build:
docker run --rm -it -v "${PWD}":/src -w /src golang make build_inside
build_inside:
cd /src && \
rm -rf target && \
mkdir -p target/windows && \
mkdir -p target/darwin && \
mkdir -p target/linux && \
GOOS=windows go build -ldflags "-X main.Version=$(VERSION)" -o target/windows/gmig.exe && \
GOOS=darwin go build -ldflags "-X main.Version=$(VERSION)" -o target/darwin/gmig && \
GOOS=linux go build -ldflags "-X main.Version=$(VERSION)" -o target/linux/gmig && \
chmod +x -R target
zip:
zip target/darwin/gmig.zip target/darwin/gmig && \
zip target/linux/gmig.zip target/linux/gmig && \
zip target/windows/gmig.zip target/windows/gmig.exe
# go get github.com/aktau/github-release
# export GITHUB_TOKEN=...
.PHONY: createrelease
createrelease:
github-release info -u emicklei -r gmig
github-release release \
--user emicklei \
--repo gmig \
--tag $(shell git describe --abbrev=0 --tags) \
--name "gmig" \
--description "gmig - google infrastructure-as-code tool"
.PHONY: uploadrelease
uploadrelease:
github-release upload \
--user emicklei \
--repo gmig \
--tag $(shell git describe --abbrev=0 --tags) \
--name "gmig-Linux-x86_64.zip" \
--file target/linux/gmig.zip
github-release upload \
--user emicklei \
--repo gmig \
--tag $(shell git describe --abbrev=0 --tags) \
--name "gmig-Darwin-x86_64.zip" \
--file target/darwin/gmig.zip
github-release upload \
--user emicklei \
--repo gmig \
--tag $(shell git describe --abbrev=0 --tags) \
--name "gmig-Windows-x86_64.zip" \
--file target/windows/gmig.zip
release: build zip createrelease uploadrelease