Skip to content

Commit

Permalink
Start using goreleaser.
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Moyer <moyer@heptio.com>
  • Loading branch information
mattmoyer committed Jan 25, 2018
1 parent 4b4bc6e commit 39c25a6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/heptio-authenticator-aws
/heptio-authenticator-aws-osx
/dist
32 changes: 32 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Configuration for https://goreleaser.com/
project_name: authenticator

builds:
- binary: heptio-authenticator-aws
main: ./cmd/heptio-authenticator-aws/root.go
goos:
- darwin
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0

dockers:
- image: gcr.io/heptio-images/authenticator
extra_files:
- ca-certificates.crt

snapshot:
name_template: "git-{{.Commit}}"

archive:
format: binary

release:
github:
owner: heptio
name: authenticator
draft: true
prerelease: true
name_template: "v{{.Version}}"
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ go_import_path: github.com/heptio/authenticator
go:
- 1.9.x

sudo: false
sudo: required

services:
- docker

install:
- go get -u github.com/golang/dep/cmd/dep
&& dep ensure -vendor-only -v
- go get github.com/goreleaser/goreleaser

script:
- go install -v ./... && go test ./...
- make build test
25 changes: 12 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
default: build

CMD_IMPORT ?= github.com/heptio/authenticator/cmd/heptio-authenticator-aws
REPO ?= gcr.io/heptio-images/authenticator
VERSION ?= v0.1.0
GORELEASER := $(shell command -v goreleaser 2> /dev/null)

.PHONY: build push build-container
.PHONY: build test format

build: build-container heptio-authenticator-aws-osx
build: ca-certificates.crt
ifndef GORELEASER
$(error "goreleaser not found (`go get -u -v github.com/goreleaser/goreleaser` to fix)")
endif
$(GORELEASER) --skip-publish --rm-dist --snapshot

heptio-authenticator-aws-osx:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o heptio-authenticator-aws $(CMD_IMPORT)
# pull ca-certificates.crt from Alpine
ca-certificates.crt:
docker run -v "$$PWD":/out --rm --tty -i alpine:latest /bin/sh -c "apk add --update ca-certificates && cp /etc/ssl/certs/ca-certificates.crt /out/"

build-container:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o heptio-authenticator-aws $(CMD_IMPORT)
docker build . -t $(REPO):$(VERSION)

push:
docker push $(REPO):$(VERSION)
test:
go test -v ./...

format:
test -z "$$(find . -path ./vendor -prune -type f -o -name '*.go' -exec gofmt -d {} + | tee /dev/stderr)" || \
Expand Down

0 comments on commit 39c25a6

Please sign in to comment.