Skip to content

Commit 60f046e

Browse files
committedSep 26, 2018
Update build to use GOOS rather than docker
1 parent f2b80d1 commit 60f046e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎Makefile

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# the current tag else the current git sha
2-
VERSION := $(shell git tag --points-at=HEAD | grep . || git rev-parse --short HEAD)
3-
4-
GOBUILD_ARGS := -ldflags "-X main.Version=$(VERSION)"
5-
OS := $(shell go env GOOS)
6-
ARCH := $(shell go env GOHOSTARCH)
1+
VERSION=$(shell git describe --tags --candidates=1 --dirty)
2+
FLAGS=-X main.Version=$(VERSION) -s -w
73

84
# To create a new release:
95
# $ git tag vx.x.x
106
# $ git push --tags
117
# $ make clean
12-
# $ make release # this will create 2 binaries in ./bin - darwin and linux
8+
# $ make release # this will create 3 binaries in ./bin
139
#
1410
# Next, go to https://github.com/99designs/iamy/releases/new
1511
# - select the tag version you just created
1612
# - Attach the binaries from ./bin/*
1713

18-
release: bin/iamy-linux-amd64 bin/iamy-$(OS)-$(ARCH)
14+
release: bin/iamy-linux-amd64 bin/iamy-darwin-amd64 bin/iamy-windows-386.exe
1915

2016
bin/iamy-linux-amd64:
2117
@mkdir -p bin
22-
docker run -it -v $$GOPATH:/go golang:latest go build $(GOBUILD_ARGS) -o /go/src/github.com/99designs/iamy/$@ github.com/99designs/iamy
18+
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" .
19+
20+
bin/iamy-darwin-amd64:
21+
@mkdir -p bin
22+
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" .
2323

24-
bin/iamy-$(OS)-$(ARCH):
24+
bin/iamy-windows-386.exe:
2525
@mkdir -p bin
26-
go build $(GOBUILD_ARGS) -o bin/iamy-$(OS)-$(ARCH) .
26+
GOOS=windows GOARCH=386 go build -o $@ -ldflags="$(FLAGS)" .
2727

2828
clean:
2929
rm -f bin/*

0 commit comments

Comments
 (0)
Please sign in to comment.