diff --git a/.travis.yml b/.travis.yml index 3d7ef97..4af9578 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,8 +42,9 @@ jobs: go: "1.12" script: make e2e - stage: release - script: make build - go: "1.12.1" # explicit version to ease reproducibility + script: make release GOARCHES="amd64 arm arm64" + go: "1.12.7" # explicit version to ease reproducibility + if: tag IS present deploy: provider: releases api_key: diff --git a/Makefile b/Makefile index 4afa8c6..0a5bf39 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ -VERSION=`git describe --tags --dirty --always` +VERSION := $(shell git describe --tags --dirty --always) -GOFLAGS=-ldflags "-X main.version=${VERSION}" -gcflags=all=-trimpath=$(PWD) -asmflags=all=-trimpath=$(PWD) +GOFLAGS := -ldflags "-X main.version=$(VERSION)" -gcflags=all=-trimpath=$(PWD) -asmflags=all=-trimpath=$(PWD) + +GOARCHES := $(shell go env GOARCH) build: - GOARCH=amd64 go build ${GOFLAGS} -o wesher-amd64 ${OPTS} - GOARCH=arm go build ${GOFLAGS} -o wesher-arm ${OPTS} - GOARCH=arm64 go build ${GOFLAGS} -o wesher-arm64 ${OPTS} + $(foreach GOARCH,$(GOARCHES),GOARCH=$(GOARCH) go build ${GOFLAGS} -o wesher$(if $(filter-out $(GOARCH), $(GOARCHES)),-$(GOARCH));) + +release: build sha256sum wesher-* > wesher.sha256sums e2e: - tests/e2e.sh \ No newline at end of file + tests/e2e.sh + +clean: + rm -f wesher wesher-* wesher.sha256sums + +.PHONY: build release e2e clean \ No newline at end of file