Skip to content

Commit

Permalink
Merge pull request #9 from aktsk/versioning-and-releasing
Browse files Browse the repository at this point in the history
Versioning and releasing
  • Loading branch information
mizzy authored Apr 16, 2018
2 parents 488503b + 8715e4b commit 4695474
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
NAME := kalvados
VERSION = $(shell gobump show -r)

all: build

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 ./...
Expand All @@ -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}
16 changes: 16 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions vesion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

const version = "0.1.0"

0 comments on commit 4695474

Please sign in to comment.