From 909b176ce47d9d8507186c03dd23e0b41ef90e12 Mon Sep 17 00:00:00 2001 From: Steve Brunton Date: Wed, 31 Oct 2018 23:17:19 -0400 Subject: [PATCH] building with circle-ci building binaries via circle-ci now. --- .circleci/config.yml | 13 +++++++++++++ Makefile | 18 ++++++++++++++++++ VERSION | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml create mode 100644 Makefile diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..ac8360e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,13 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/golang:1.10.4-stretch + working_directory: /go/src/github.com/nshttpd/mikrotik-exporter + branches: + only: + - master + - /^nshttpd.*/ + steps: + - checkout + - run: make deploy \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef8bf5f --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +# go run -ldflags "-X github.com/nshttpd/mikrotik-exporter/cmd.version=6.6.7-BETA -X github.com/nshttpd/mikrotik-exporter/cmd.shortSha=`git rev-parse HEAD`" main.go version + +VERSION=`cat VERSION` +SHORTSHA=`git rev-parse --short HEAD` + +LDFLAGS=-X github.com/nshttpd/mikrotik-exporter/cmd.version=$(VERSION) +LDFLAGS+=-X github.com/nshttpd/mikrotik-exporter/cmd.shortSha=$(SHORTSHA) + +build: + go build -ldflags "$(LDFLAGS)" . + +utils: + go get github.com/mitchellh/gox + go get github.com/tcnksm/ghr + +deploy: utils + gox -parallel=4 -ldflags "$(LDFLAGS)" -output "dist/mikrotik-exporter_{{.OS}}_{{.Arch}}" + ghr -t $(GITHUB_TOKEN) -u $(CIRCLE_PROJECT_USERNAME) -r $(CIRCLE_PROJECT_REPONAME) -replace $(VERSION) dist/ \ No newline at end of file diff --git a/VERSION b/VERSION index bd52db8..afaf360 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.0 \ No newline at end of file +1.0.0 \ No newline at end of file