diff --git a/Makefile b/Makefile index 8918abc..1d51493 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ NAME := kalvados +VERSION = $(shell gobump show -r) all: build @@ -6,6 +7,9 @@ setup: go get golang.org/x/vgo go get github.com/golang/lint/golint go get golang.org/x/tools/cmd/goimports + go get github.com/tcnksm/ghr + go get github.com/Songmu/goxz/cmd/goxz + go get github.com/motemen/gobump/cmd/gobump test: lint vgo test ./... @@ -19,8 +23,22 @@ fmt: setup goimports -w . build: - vgo build -o bin/$(NAME) cmd/kalvados/main.go - vgo build -o bin/$(NAME)-server cmd/kalvados-server/main.go + vgo build -o bin/$(NAME) cmd/$(NAME)/main.go + vgo build -o bin/$(NAME)-server cmd/$(NAME)-server/main.go clean: rm bin/$(NAME) + +package: setup + @sh -c "'$(CURDIR)/scripts/package.sh'" + +crossbuild: setup + goxz -pv=v${VERSION} -build-ldflags="-X main.GitCommit=${COMMIT}" \ + -arch=386,amd64 -d=./pkg/dist/v${VERSION} \ + -n ${NAME} ./cmd/${NAME} + goxz -pv=v${VERSION} -build-ldflags="-X main.GitCommit=${COMMIT}" \ + -arch=386,amd64 -d=./pkg/dist/v${VERSION} \ + -n ${NAME}-server ./cmd/${NAME}-server + +release: package + ghr -u aktsk v${VERSION} ./pkg/dist/v${VERSION} diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 0000000..ced6e12 --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +DIR=$(cd $(dirname ${0})/.. && pwd) +cd ${DIR} + +test -d pkg && rm -rf ./pkg +make crossbuild + +VERSION=$(gobump show -r) + +# Generate shasum +pushd ./pkg/dist/v${VERSION} +shasum -a 256 * > ./v${VERSION}_SHASUMS +popd + diff --git a/vesion.go b/vesion.go new file mode 100644 index 0000000..310674e --- /dev/null +++ b/vesion.go @@ -0,0 +1,3 @@ +package main + +const version = "0.1.0"