-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
60 lines (52 loc) · 1.5 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
sudo: required
services:
- docker
language: go
go:
- 1.11
addons:
apt:
packages:
- dpkg
- debconf
- debhelper
- lintian
- fakeroot
before_install:
- go get github.com/mitchellh/gox
install: true
before_script:
- git config --local user.name "CheeressCloud"
- git config --local user.email "nnsceg@gmail.com"
script:
- diff -u <(echo -n) <(gofmt -d `find . -type f -name '*.go' -not -path "./vendor/*"`)
- go vet $(go list ./... | grep -v /vendor/)
- CGO_ENABLED=0 gox -os="linux darwin" -arch="amd64" -output="{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-s -X main.Rev=`git rev-parse --short HEAD`" -verbose ./...
- cp ./cexporter_linux_amd64 ./deb/cexporter/usr/bin/cexporter
- rm ./deb/cexporter/usr/bin/.gitkeep
- cd deb
- fakeroot dpkg-deb --build cexporter
- lintian cexporter.deb || true
- mv cexporter.deb "cexporter-$TRAVIS_TAG.deb"
- cd ..
after_success:
- if [ -n "$TRAVIS_TAG" ]; then
ls -lah cexporter_*;
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD;
docker build --build-arg version=$TRAVIS_TAG -t cheerlesscloud/cexporter -t cheerlesscloud/cexporter:$TRAVIS_TAG .;
docker push cheerlesscloud/cexporter;
docker push cheerlesscloud/cexporter:$TRAVIS_TAG;
fi
deploy:
provider: releases
skip_cleanup: true
api_key: "$GITHUB_AUTH_TOKEN"
file:
- cexporter_linux_amd64
- cexporter_darwin_amd64
- deb/cexporter-$TRAVIS_TAG.deb
draft: true
on:
repo: CheerlessCloud/cexporter
branch: master
tags: true