From fc35edd41c845176f55968aaf5858e8ff9354a99 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 28 Oct 2016 14:54:35 +0200 Subject: [PATCH] Push releases to Github --- .repo-runner.yaml | 10 ++++++++++ Makefile | 3 +++ publish.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .repo-runner.yaml create mode 100755 publish.sh diff --git a/.repo-runner.yaml b/.repo-runner.yaml new file mode 100644 index 0000000..d54498e --- /dev/null +++ b/.repo-runner.yaml @@ -0,0 +1,10 @@ +--- + +image: "quay.io/luzifer/repo-runner-image" +checkout_dir: /go/src/github.com/Luzifer/duplicity-backup + +commands: + - make ci + +environment: + CGO_ENABLED: 0 diff --git a/Makefile b/Makefile index cc1c97d..4f18770 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ bindata: go-bindata help.txt +ci: + ./publish.sh + setup-testenv: go get github.com/onsi/ginkgo/ginkgo go get github.com/onsi/gomega diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..3e57c0b --- /dev/null +++ b/publish.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +VERSION=$(git describe --tags --exact-match) +REPO=$(basename $(pwd)) +ARCHS="linux/386 linux/amd64 linux/arm darwin/amd64 darwin/386 windows/amd64" + +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 + +gox -ldflags="-X main.version=${VERSION}" -osarch="${ARCHS}" +sha256sum ${REPO}_* > SHA256SUMS + +github-release release --user Luzifer --repo ${REPO} --tag ${VERSION} --name ${VERSION} --draft || true + +for file in ${REPO}_* SHA256SUMS; do + github-release upload --user Luzifer --repo ${REPO} --tag ${VERSION} --name ${file} --file ${file} +done