diff --git a/.gitignore b/.gitignore index 88ddcdf4..f5889482 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ _output/ +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..7ee61762 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,52 @@ +project_name: kubectl-trace +before: + hooks: + - go mod tidy +builds: + - id: "kubectl-trace" + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - 386 + main: ./cmd/kubectl-trace + env: + - GO111MODULE=on + - CGO_ENABLED=0 + ldflags: | + -X github.com/iovisor/kubectl-trace/pkg/version.buildTime={{ .Timestamp }} + -X github.com/iovisor/kubectl-trace/pkg/version.gitCommit={{ .Commit }} + -X github.com/iovisor/kubectl-trace/pkg/version.imageName={{ .Env.IMAGE_NAME }} + binary: kubectl-trace + - id: "trace-runner" + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - 386 + main: ./cmd/trace-runner + env: + - GO111MODULE=on + - CGO_ENABLED=0 + ldflags: | + -X github.com/iovisor/kubectl-trace/pkg/version.buildTime={{ .Timestamp }} + -X github.com/iovisor/kubectl-trace/pkg/version.gitCommit={{ .Commit }} + -X github.com/iovisor/kubectl-trace/pkg/version.imageName={{ .Env.IMAGE_NAME }} + binary: trace-runner + +archives: + - id: windows + format_overrides: + - goos: windows + format: zip + +snapshot: + name_template: 'master' + +release: + github: + prerelease: auto diff --git a/.travis.yml b/.travis.yml index aec8509d..28c59f27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,21 @@ go: - 1.11.4 services: - docker +before_install: +- curl -LO https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_amd64.deb && sudo dpkg -i goreleaser_amd64.deb script: - make test - make _output/bin/kubectl-trace - ./hack/ci-build-image.sh - make integration +- make cross after_success: - ./hack/ci-release-image.sh + +deploy: +- provider: script + skip_cleanup: true + script: goreleaser + on: + tags: true + condition: $TRAVIS_OS_NAME = linux diff --git a/Makefile b/Makefile index 6c31a5d9..af416208 100644 --- a/Makefile +++ b/Makefile @@ -37,9 +37,14 @@ ${kubectl_trace}: ${trace_runner}: CGO_ENABLED=1 $(GO) build ${LDFLAGS} -o $@ ./cmd/trace-runner +.PHONY: cross +cross: + IMAGE_NAME=$(IMAGE_NAME) GO111MODULE=on goreleaser --snapshot --rm-dist + .PHONY: clean clean: - rm -Rf _output + $(RM) -R _output + $(RM) -R dist .PHONY: image/build-init image/build-init: