Skip to content

Commit

Permalink
add scripts to prepare releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptobioz committed Jun 14, 2019
1 parent d9472c8 commit b313521
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ coverage
*.log
*.box
.vagrant/
release/
7 changes: 5 additions & 2 deletions Makefile
Expand Up @@ -6,11 +6,14 @@ BUILD_DATE = $(shell date +%Y-%m-%d)
all: lint vet test bivac

bivac: main.go $(DEPS)
GO111MODULE=on CGO_ENABLED=0 GOOS=linux \
GO111MODULE=on CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) \
go build -mod=vendor -a \
-ldflags="-s -X main.version=$(VERSION) -X main.buildDate=$(BUILD_DATE) -X main.commitSha1=$(COMMIT_SHA1)" \
-installsuffix cgo -o $@ $<
strip $@
@if [ "${GOOS}" = "linux" ]; then strip $@; fi

build-release: clean
GO_VERSION=1.12 ./scripts/build-release.sh

lint:
@go get -u -v golang.org/x/lint/golint
Expand Down
25 changes: 25 additions & 0 deletions scripts/build-release.sh
@@ -0,0 +1,25 @@
#!/bin/bash

if [ -z $GO_VERSION ]; then
GO_VERSION=latest
fi

docker pull golang:$GO_VERSION

VERSION=$(git describe --always --dirty)

PLATFORMS=(darwin linux windows)
ARCHITECTURES=(386 amd64)

mkdir -p release

for platform in ${PLATFORMS[@]}; do
for arch in ${ARCHITECTURES[@]}; do
rm -f bivac
docker run -it --rm -w /go/src/github.com/camptocamp/bivac -v $(pwd):/go/src/github.com/camptocamp/bivac \
-e GOOS=${platform} \
-e GOARCH=${arch} \
golang:$GO_VERSION make bivac
zip release/bivac_${VERSION}_${platform}_${arch}.zip bivac
done
done

0 comments on commit b313521

Please sign in to comment.