From 94f3937c0ed77ea2a72252c78a2c878fb8424178 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 31 Aug 2021 16:13:36 +0300 Subject: [PATCH] [#785] make: Add preparing release binaries Signed-off-by: Pavel Karpy --- .gitignore | 1 + Makefile | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3212ac5b..973d50a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea bin +release temp cmd/test /plugins/ diff --git a/Makefile b/Makefile index a57c306a..1166c969 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,19 @@ DEBUG ?= false HUB_IMAGE ?= nspccdev/neofs HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" +GO_VERSION ?= 1.16 + BIN = bin -DIRS= $(BIN) +DIRS = $(BIN) + +RELEASE = release +ARCH = amd64 # List of binaries to build. CMDS = $(notdir $(basename $(wildcard cmd/*))) BINS = $(addprefix $(BIN)/, $(CMDS)) -.PHONY: help all dep clean fmts fmt imports test lint docker/lint +.PHONY: help all dep clean fmts fmt imports test lint docker/lint prepare-release # To build a specific binary, use it's name prefix with bin/ as a target # For example `make bin/neofs-node` will build only storage node binary @@ -37,6 +42,18 @@ $(DIRS): @echo "⇒ Ensure dir: $@" @mkdir -p $@ +# Directory for release files +$(RELEASE): + @echo "⇒ Ensure dir: $@" + @mkdir -p $@ + +# Prepare binaries and archives for release +prepare-release: $(RELEASE) docker/all + @for file in $$(find $(BIN) -name 'neofs-*' -printf "%f\n"); do \ + cp $(BIN)/$$file $(RELEASE)/$$file-$(ARCH) && \ + tar -czf $(RELEASE)/$$file-$(ARCH).tar.gz $(RELEASE)/$$file-$(ARCH) ; \ + done + # Pull go dependencies dep: @printf "⇒ Download requirements: " @@ -135,3 +152,4 @@ help: clean: rm -rf vendor rm -rf $(BIN) + rm -rf $(RELEASE)