summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-09-13 12:13:55 +0200
committerMartin Polden <mpolden@mpolden.no>2021-09-13 14:15:17 +0200
commitc2f997b4792529535e544ec3957bdf6369e6ef63 (patch)
tree4c60f680a3c6cb4a346c2ffcf8507a6df346728a /client
parent060f5acbf430f5219db8c676f35034489fa86c6c (diff)
Add GitHub release target
Diffstat (limited to 'client')
-rw-r--r--client/go/Makefile47
-rw-r--r--client/go/README.md6
2 files changed, 46 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
#
diff --git a/client/go/README.md b/client/go/README.md
new file mode 100644
index 00000000000..7b5b222503c
--- /dev/null
+++ b/client/go/README.md
@@ -0,0 +1,6 @@
+The command-line tool for Vespa.ai.
+
+Use it on Vespa instances running locally, remotely or in the cloud.
+Prefer web service API's to this in production.
+
+Vespa documentation: https://docs.vespa.ai