building with circle-ci

building binaries via circle-ci now.
This commit is contained in:
Steve Brunton 2018-10-31 23:17:19 -04:00 committed by GitHub
parent 0f7d5bea2c
commit 909b176ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 1 deletions

13
.circleci/config.yml Normal file
View File

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

18
Makefile Normal file
View File

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

View File

@ -1 +1 @@
0.0.0
1.0.0