Automate pushing release binaries
@@ -18,7 +18,6 @@ ARCHES=$(patsubst Dockerfile.%,%,$(wildcard Dockerfile.*))
# ARCH is the target architecture
# we need to keep track of them separately
BUILDARCH ?= $(shell uname -m)
-BUILDOS ?= $(shell uname -s | tr A-Z a-z)
# canonicalized names for host architecture
ifeq ($(BUILDARCH),aarch64)
@@ -453,20 +452,18 @@ release-publish: release-prereqs
# Push images.
$(MAKE) push-all push-manifests push-non-manifests IMAGETAG=$(VERSION)
- @echo "Finalize the GitHub release based on the pushed tag."
+ # Push binaries to GitHub release.
+ # Requires ghr: https://github.com/tcnksm/ghr
+ # Requires GITHUB_TOKEN environment variable set.
+ ghr -r calicoctl \
+ -b "Release notes can be found at https://docs.projectcalico.org" \
+ -n $(VERSION) \
+ $(VERSION) ./bin/
+
+ @echo "Confirm that the release was published at the following URL."
@echo ""
@echo " https://$(PACKAGE_NAME)/releases/tag/$(VERSION)"
@echo ""
- @echo "Attach the following binaries to the release."
- @echo ""
- @echo "- bin/calicoctl"
- @echo "- bin/calicoctl-linux-amd64"
- @echo "- bin/calicoctl-linux-arm64"
- @echo "- bin/calicoctl-linux-ppc64le"
- @echo "- bin/calicoctl-linux-s390x"
- @echo "- bin/calicoctl-darwin-amd64"
- @echo "- bin/calicoctl-windows-amd64.exe"
- @echo ""
@echo "If this is the latest stable release, then run the following to push 'latest' images."
@echo ""
@echo " make VERSION=$(VERSION) release-publish-latest"
@@ -494,6 +491,12 @@ endif
ifdef LOCAL_BUILD
$(error LOCAL_BUILD must not be set for a release)
endif
+ifndef GITHUB_TOKEN
+ $(error GITHUB_TOKEN must be set for a release)
+endif
+ifeq (, $(shell which ghr))
+ $(error Unable to find `ghr` in PATH, run this: go get -u github.com/tcnksm/ghr)
+endif
###############################################################################
# Developer helper scripts (not used by build or test)
