Skip to content

Commit 35b4793

Browse files
committed
update ci to push latest
1 parent 504062b commit 35b4793

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.goreleaser.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ dockers:
2626
dockerfile: Dockerfile
2727
image_templates:
2828
- "nuvo/{{.ProjectName}}:{{ .Tag }}"
29-
- "nuvo/{{.ProjectName}}:latest"

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
deploy:
1010
- provider: script
1111
skip_cleanup: true
12-
script: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD && curl -sL https://git.io/goreleaser | bash
12+
script: curl -sL https://git.io/goreleaser | bash
1313
on:
1414
tags: true
1515
condition: $TRAVIS_OS_NAME = linux

Makefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ GIT_TAG := $(shell git describe --tags --always)
44
GIT_COMMIT := $(shell git rev-parse --short HEAD)
55
LDFLAGS := "-X main.GitTag=${GIT_TAG} -X main.GitCommit=${GIT_COMMIT}"
66
DIST := $(CURDIR)/dist
7+
DOCKER_USER := $(shell printenv DOCKER_USER)
8+
DOCKER_PASSWORD := $(shell printenv DOCKER_PASSWORD)
9+
TRAVIS := $(shell printenv TRAVIS)
710

8-
all: bootstrap build
11+
all: bootstrap build docker push
912

1013
fmt:
1114
go fmt ./pkg/... ./cmd/...
@@ -17,6 +20,24 @@ vet:
1720
build: fmt vet
1821
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o bin/cain cmd/cain.go
1922

23+
# Build cain docker image
24+
docker: fmt vet
25+
cp bin/cain cain
26+
docker build -t nuvo/cain:latest .
27+
rm cain
28+
29+
30+
# Push will only happen in travis ci
31+
push:
32+
ifdef TRAVIS
33+
ifdef DOCKER_USER
34+
ifdef DOCKER_PASSWORD
35+
docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD)
36+
docker push nuvo/cain:latest
37+
endif
38+
endif
39+
endif
40+
2041
bootstrap:
2142
ifndef HAS_DEP
2243
wget -q -O $(GOPATH)/bin/dep https://github.com/golang/dep/releases/download/$(DEP_VERSION)/dep-linux-amd64

0 commit comments

Comments
 (0)