release script

This commit is contained in:
Liam Galvin 2018-11-24 17:15:51 +00:00
parent 76397d2115
commit 261424c9ec
3 changed files with 46 additions and 37 deletions

View File

@ -11,3 +11,4 @@ jobs:
steps: steps:
- checkout - checkout
- run: make test - run: make test
- run: make release

View File

@ -1,6 +1,5 @@
SHELL := /bin/bash SHELL := /bin/bash
BINARY := aminal BINARY := aminal
VERSION ?= vlatest
FONTPATH := ./gui/packed-fonts FONTPATH := ./gui/packed-fonts
.PHONY: build .PHONY: build
@ -23,6 +22,7 @@ install-tools:
which dep || curl -L https://raw.githubusercontent.com/golang/dep/master/install.sh | sh 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 packr || go get -u github.com/gobuffalo/packr/packr
which github-release || go get -u github.com/aktau/github-release which github-release || go get -u github.com/aktau/github-release
which xgo || go get github.com/karalabe/xgo
.PHONY: update-fonts .PHONY: update-fonts
update-fonts: install-tools update-fonts: install-tools
@ -32,40 +32,5 @@ update-fonts: install-tools
.PHONY: release .PHONY: release
release: test install-tools release: test install-tools
echo -n "Enter a version: " ./scripts/release.sh
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}

43
scripts/release.sh Executable file
View File

@ -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}