diff --git a/.circleci/config.yml b/.circleci/config.yml index c6f359a..6aee5e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,3 +11,4 @@ jobs: steps: - checkout - run: make test + - run: make release \ No newline at end of file diff --git a/Makefile b/Makefile index 847f07b..0879515 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ SHELL := /bin/bash BINARY := aminal -VERSION ?= vlatest FONTPATH := ./gui/packed-fonts .PHONY: build @@ -23,6 +22,7 @@ install-tools: which dep || curl -L https://raw.githubusercontent.com/golang/dep/master/install.sh | sh which packr || go get -u github.com/gobuffalo/packr/packr which github-release || go get -u github.com/aktau/github-release + which xgo || go get github.com/karalabe/xgo .PHONY: update-fonts update-fonts: install-tools @@ -32,40 +32,5 @@ update-fonts: install-tools .PHONY: release release: test install-tools - echo -n "Enter a version: " - read -s VERSION - if [[ "${VERSION}" == "" ]]; then - exit 1 - fi - mkdir -p release/bin/darwin/amd64/ - mkdir -p release/bin/linux/amd64/ - mkdir -p release/bin/linux/i386/ - GOOS=darwin GOARCH=amd64 go build -o release/bin/darwin/amd64/${BINARY} - GOOS=linux GOARCH=amd64 go build -o release/bin/linux/amd64/${BINARY} - GOOS=linux GOARCH=386 go build -o release/bin/linux/386/${BINARY} - git tag "${VERSION}" - git push origin "${VERSION}" - github-release release \ - --user liamg \ - --repo aminal \ - --tag "${VERSION}" \ - --name "Aminal ${VERSION}" - github-release upload \ - --user liamg \ - --repo aminal \ - --tag "${VERSION}" \ - --name "${BINARY}-osx-amd64" \ - --file release/bin/darwin/amd64/${BINARY} - github-release upload \ - --user liamg \ - --repo aminal \ - --tag "${VERSION}" \ - --name "${BINARY}-linux-amd64" \ - --file release/bin/linux/amd64/${BINARY} - github-release upload \ - --user liamg \ - --repo aminal \ - --tag "${VERSION}" \ - --name "${BINARY}-linux-386" \ - --file release/bin/linux/386/${BINARY} + ./scripts/release.sh \ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..ee0ef37 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +BINARY=aminal + +if [[ "${CIRCLE_TAG}" == "" ]]; then + exit 0 # no tag, nothing to release +fi +mkdir -p release/bin/darwin/amd64/ +mkdir -p release/bin/linux/amd64/ +mkdir -p release/bin/linux/i386/ + +# build for osx using xgo - this cannot be used for linux builds due to missing deps in the xgo containers +xgo --targets=darwin/amd64 --dest=release/bin/darwin/amd64 -out ${BINARY} . + +exit 0 + + +git tag "${VERSION}" +git push origin "${VERSION}" +github-release release \ + --user liamg \ + --repo aminal \ + --tag "${VERSION}" \ + --name "Aminal ${VERSION}" +github-release upload \ + --user liamg \ + --repo aminal \ + --tag "${VERSION}" \ + --name "${BINARY}-osx-amd64" \ + --file release/bin/darwin/amd64/${BINARY} +github-release upload \ + --user liamg \ + --repo aminal \ + --tag "${VERSION}" \ + --name "${BINARY}-linux-amd64" \ + --file release/bin/linux/amd64/${BINARY} +github-release upload \ + --user liamg \ + --repo aminal \ + --tag "${VERSION}" \ + --name "${BINARY}-linux-386" \ + --file release/bin/linux/386/${BINARY}