From 9c80e921a4fbc748e013802f123194915d6dd8f1 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 11 Oct 2016 16:38:40 +0200 Subject: [PATCH] Push builds to GH releases --- .travis.yml | 7 +++++++ publish.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .travis.yml create mode 100755 publish.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2b62933 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: go + +go: + - 1.7 + +script: + - ./publish.sh diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..a3461c0 --- /dev/null +++ b/publish.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +VERSION=$(git describe --tags --exact-match) +REPO=$(basename $(pwd)) +ARCHS="linux/386 linux/amd64 linux/arm darwin/amd64 darwin/386" + +set -e + +if [ -z "${VERSION}" ]; then + echo "No tag present, stopping build now." + exit 0 +fi + +if [ -z "${GITHUB_TOKEN}" ]; then + echo "Please set \$GITHUB_TOKEN environment variable" + exit 1 +fi + +set -x + +go get github.com/aktau/github-release +go get github.com/mitchellh/gox + +github-release release --user Jimdo --repo ${REPO} --tag ${VERSION} --name ${VERSION} || true + +gox -ldflags="-X main.version=${VERSION}" -osarch="${ARCHS}" +for file in ${REPO}_*; do + github-release upload --user Jimdo --repo ${REPO} --tag ${VERSION} --name ${file} --file ${file} +done