-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build to use GOOS rather than docker
- Loading branch information
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
# the current tag else the current git sha | ||
VERSION := $(shell git tag --points-at=HEAD | grep . || git rev-parse --short HEAD) | ||
|
||
GOBUILD_ARGS := -ldflags "-X main.Version=$(VERSION)" | ||
OS := $(shell go env GOOS) | ||
ARCH := $(shell go env GOHOSTARCH) | ||
VERSION=$(shell git describe --tags --candidates=1 --dirty) | ||
FLAGS=-X main.Version=$(VERSION) -s -w | ||
|
||
# To create a new release: | ||
# $ git tag vx.x.x | ||
# $ git push --tags | ||
# $ make clean | ||
# $ make release # this will create 2 binaries in ./bin - darwin and linux | ||
# $ make release # this will create 3 binaries in ./bin | ||
# | ||
# Next, go to https://github.com/99designs/iamy/releases/new | ||
# - select the tag version you just created | ||
# - Attach the binaries from ./bin/* | ||
|
||
release: bin/iamy-linux-amd64 bin/iamy-$(OS)-$(ARCH) | ||
release: bin/iamy-linux-amd64 bin/iamy-darwin-amd64 bin/iamy-windows-386.exe | ||
|
||
bin/iamy-linux-amd64: | ||
@mkdir -p bin | ||
docker run -it -v $$GOPATH:/go golang:latest go build $(GOBUILD_ARGS) -o /go/src/github.com/99designs/iamy/$@ github.com/99designs/iamy | ||
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" . | ||
|
||
bin/iamy-darwin-amd64: | ||
@mkdir -p bin | ||
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" . | ||
|
||
bin/iamy-$(OS)-$(ARCH): | ||
bin/iamy-windows-386.exe: | ||
@mkdir -p bin | ||
go build $(GOBUILD_ARGS) -o bin/iamy-$(OS)-$(ARCH) . | ||
GOOS=windows GOARCH=386 go build -o $@ -ldflags="$(FLAGS)" . | ||
|
||
clean: | ||
rm -f bin/* |