Skip to content

Commit

Permalink
update ci to push latest
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr committed Dec 4, 2018
1 parent 504062b commit 35b4793
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ dockers:
dockerfile: Dockerfile
image_templates:
- "nuvo/{{.ProjectName}}:{{ .Tag }}"
- "nuvo/{{.ProjectName}}:latest"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
deploy:
- provider: script
skip_cleanup: true
script: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD && curl -sL https://git.io/goreleaser | bash
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ GIT_TAG := $(shell git describe --tags --always)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS := "-X main.GitTag=${GIT_TAG} -X main.GitCommit=${GIT_COMMIT}"
DIST := $(CURDIR)/dist
DOCKER_USER := $(shell printenv DOCKER_USER)
DOCKER_PASSWORD := $(shell printenv DOCKER_PASSWORD)
TRAVIS := $(shell printenv TRAVIS)

all: bootstrap build
all: bootstrap build docker push

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

# Build cain docker image
docker: fmt vet
cp bin/cain cain
docker build -t nuvo/cain:latest .
rm cain


# Push will only happen in travis ci
push:
ifdef TRAVIS
ifdef DOCKER_USER
ifdef DOCKER_PASSWORD
docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD)
docker push nuvo/cain:latest
endif
endif
endif

bootstrap:
ifndef HAS_DEP
wget -q -O $(GOPATH)/bin/dep https://github.com/golang/dep/releases/download/$(DEP_VERSION)/dep-linux-amd64
Expand Down

0 comments on commit 35b4793

Please sign in to comment.