add goreleaser (#49)

* add goreleaser

Add a goreleaser configuration file that builds binaries for Linux,
MacOS and Windows, for 32bit (x86/386) and 64bit (x64/amd64). The
binaries will be archived into a tar.gz/zip file along with the LICENSE
file.

The `dist/` directory will be written to by goreleaser with the binaries
during the build process, so it's also been added to .gitignore.

To build all the binaries and release them to GitHub:
1. Tag the release. e.g. `git tag -a v1.0.0 -m 'First release'`
2. Generate a GitHub Personal Access Token. See https://github.com/settings/tokens.
3. Push the release to GitHub. e.g. `git push origin v1.0.0`
4. Make the release, which will publish binaries to the GitHub "Releases" page. e.g.  `GITHUB_TOKEN=xxxxxxx... make release`

* add -version flag

Run `grpcurl -version` to see the release version. Use `make install` to build a binary that shows the version based on current git hash (which will show a version number if HEAD is a release tag and otherwise uses `git describe` to summarize the version).
This commit is contained in:
Leigh McCulloch
2018-09-25 06:34:02 -07:00
committed by Joshua Humphries
parent d4d048fade
commit 79a550b858
5 changed files with 46 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
dev_build_version=$(shell git describe --tags --always --dirty)
# TODO: run golint and errcheck, but only to catch *new* violations and
# decide whether to change code or not (e.g. we need to be able to whitelist
# violations already in the code). They can be useful to catch errors, but
@@ -16,7 +18,12 @@ updatedeps:
.PHONY: install
install:
go install ./...
go install -ldflags '-X "main.version=dev build $(dev_build_version)"' ./...
.PHONY: release
release:
@GO111MODULE=off go get github.com/goreleaser/goreleaser
goreleaser --rm-dist
.PHONY: checkgofmt
checkgofmt: