From 96543fb28c47d56923e8628dd87901e685cecbee Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Fri, 19 Feb 2021 17:52:13 +0100 Subject: [PATCH] Add build-release script --- .circleci/config.yml | 4 ++-- shuttermint/build-release | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 shuttermint/build-release diff --git a/.circleci/config.yml b/.circleci/config.yml index b69b11cb..ffb8ab25 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -189,9 +189,9 @@ jobs: - restore_cache: keys: - shuttermint-go-v8-{{ checksum "go.sum" }} - - run: make build + - run: env VERSION=${CIRCLE_TAG} ./build-release - run: go install github.com/tcnksm/ghr@v0.13.0 - - run: ghr ${CIRCLE_TAG} bin/shuttermint + - run: ghr ${CIRCLE_TAG} bin/ mint-lint: executor: go diff --git a/shuttermint/build-release b/shuttermint/build-release new file mode 100755 index 00000000..22104a74 --- /dev/null +++ b/shuttermint/build-release @@ -0,0 +1,16 @@ +#! /usr/bin/env bash +set -euo pipefail + +: "${GO:=go}" + +if [[ -z "${VERSION}" ]]; then + VERSION=$(git describe --tags --always --abbrev=4 --dirty) +fi + + +arch=amd64 +for os in linux freebsd openbsd darwin; do + target=bin/shuttermint-${os}-${arch}-${VERSION} + echo "Building ${target}" + env GOARCH=${arch} GOOS=${os} ${GO} build -o ${target} -ldflags "-X github.com/brainbot-com/shutter/shuttermint/cmd/shversion.Version=${VERSION}" . +done