diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-13 12:13:55 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-13 14:15:17 +0200 |
commit | c2f997b4792529535e544ec3957bdf6369e6ef63 (patch) | |
tree | 4c60f680a3c6cb4a346c2ffcf8507a6df346728a /client/go/Makefile | |
parent | 060f5acbf430f5219db8c676f35034489fa86c6c (diff) |
Add GitHub release target
Diffstat (limited to 'client/go/Makefile')
-rw-r--r-- | client/go/Makefile | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/client/go/Makefile b/client/go/Makefile index de66b7c8fb1..17748d765c8 100644 --- a/client/go/Makefile +++ b/client/go/Makefile @@ -1,8 +1,12 @@ # Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -# When building a new release the build system should set the VERSION -# environment variable to version being built or released -VERSION ?= $(shell echo "0.0.0-`git rev-parse --short HEAD`") +# The version to release. Defaults to the current tag or revision. +# Use env VERSION=X.Y.Z make ... to override +VERSION ?= $(shell git describe --tags 2> /dev/null | sed -E "s/^vespa-|-1$$//g") +DEVEL_VERSION := $(shell echo "0.0.0-`git rev-parse --short HEAD`") +ifeq ($(VERSION),) + VERSION = $(DEVEL_VERSION) +endif BIN ?= $(CURDIR)/bin SHARE ?= $(CURDIR)/share @@ -18,15 +22,36 @@ all: test checkfmt install # Dist targets # -# Bump the version of the vespa-cli formula and create a pull request to Homebrew repository -dist-homebrew: +# Bump the version of the vespa-cli formula and create a pull request to Homebrew repository. +# +# Example: +# +# $ git checkout vespa-X.Y.Z-1 +# $ make dist-github +dist-homebrew: dist-version brew bump-formula-pr --tag vespa-$(VERSION)-1 --version $(VERSION) vespa-cli +# Create a GitHub release draft for all platforms. Note that this only creates a +# draft, which is not publicly visible until it's explicitly published. +# +# Once the release has been created this prints an URL to the release draft. +# +# This requires the GitHub CLI to be installed: brew install gh +# +# Example: +# +# $ git checkout vespa-X.Y.Z-1 +# $ make dist-github +dist-github: dist + gh release create v$(VERSION) --repo vespa-engine/vespa --notes-file $(CURDIR)/README.md --draft --title "Vespa CLI $(VERSION)" \ + $(DIST)/vespa-cli_$(VERSION)_sha256sums.txt \ + $(DIST)/vespa-cli_$(VERSION)_*.{zip,tar.gz} + # # Cross-platform build targets # -dist: $(DIST_TARGETS) sha256sums +dist: $(DIST_TARGETS) dist-sha256sums dist-mac: GOOS=darwin dist-mac: GOARCH=amd64 @@ -41,7 +66,7 @@ dist-win64: GOOS=windows dist-win64: GOARCH=amd64 $(DIST_TARGETS): DIST_NAME=vespa-cli_$(VERSION)_$(GOOS)_$(GOARCH) -$(DIST_TARGETS): manpages +$(DIST_TARGETS): dist-version manpages $(DIST_TARGETS): mkdir -p $(DIST)/$(DIST_NAME)/bin env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(DIST)/$(DIST_NAME)/bin $(GO_FLAGS) ./... @@ -53,6 +78,14 @@ $(DIST_TARGETS): tar -czvf $(DIST)/$(DIST_NAME).tar.gz -C $(DIST) $(DIST_NAME); \ fi +dist-sha256sums: + cd $(DIST) && sha256sum vespa-cli_$(VERSION)_*.{zip,tar.gz} > vespa-cli_$(VERSION)_sha256sums.txt + +dist-version: +ifeq ($(VERSION),$(DEVEL_VERSION)) + $(error Invalid release version: $(VERSION). Try 'git checkout vespa-X.Y.Z-1' or 'env VERSION=X.Y.Z make ...') +endif + # # Development targets # |