Skip to content

Commit

Permalink
Streamlined Makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
yawn committed Feb 18, 2016
1 parent 7f9b95c commit 977cb69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
out/
build/
.token
30 changes: 14 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
TOKEN = `cat .token`
VERSION := "1.0.0-RC1"
REPO := envplate
USER := kreuzwerker
VERSION := "v0.0.8"
TOKEN = `cat .token`
FLAGS := "-X=main.build=`git rev-parse --short HEAD` -X=main.version=$(VERSION)"

build: darwin linux
.PHONY: build clean release retract

build:
cd bin && mkdir -p build && gox -osarch="linux/amd64 linux/arm darwin/amd64" -ldflags $(FLAGS) -output "../build/{{.OS}}-{{.Arch}}/ep";

darwin:
mkdir -p out/darwin
GOOS=darwin go build -o out/darwin/ep -ldflags "-X=main.build=`git rev-parse --short HEAD`" bin/envplate.go
linux:
mkdir -p out/linux
GOOS=linux go build -o out/linux/ep -ldflags "-X=main.build=`git rev-parse --short HEAD`" bin/envplate.go
clean:
rm -rf out
rm -rf build

release:
git tag $(VERSION) -f && git push --tags -f
github-release release --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN)
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN) --name ep-osx --file out/darwin/ep
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN) --name ep-linux --file out/linux/ep

test:
go test -cover
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN) --name ep-linux --file build/linux-amd64/ep
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN) --name ep-linux-arm --file build/linux-arm/ep
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) -s $(TOKEN) --name ep-osx --file build/darwin-amd64/ep

.PHONY: test
retract:
github-release delete --tag $(VERSION) -s $(TOKEN)

0 comments on commit 977cb69

Please sign in to comment.