[#785] make: Add preparing release binaries

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-08-31 16:13:36 +03:00 committed by Stanislav Bogatyrev
parent 9fa4a254b2
commit 94f3937c0e
2 changed files with 21 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.idea .idea
bin bin
release
temp temp
cmd/test cmd/test
/plugins/ /plugins/

View file

@ -9,14 +9,19 @@ DEBUG ?= false
HUB_IMAGE ?= nspccdev/neofs HUB_IMAGE ?= nspccdev/neofs
HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')"
GO_VERSION ?= 1.16
BIN = bin BIN = bin
DIRS = $(BIN) DIRS = $(BIN)
RELEASE = release
ARCH = amd64
# List of binaries to build. # List of binaries to build.
CMDS = $(notdir $(basename $(wildcard cmd/*))) CMDS = $(notdir $(basename $(wildcard cmd/*)))
BINS = $(addprefix $(BIN)/, $(CMDS)) 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 # 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 # For example `make bin/neofs-node` will build only storage node binary
@ -37,6 +42,18 @@ $(DIRS):
@echo "⇒ Ensure dir: $@" @echo "⇒ Ensure dir: $@"
@mkdir -p $@ @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 # Pull go dependencies
dep: dep:
@printf "⇒ Download requirements: " @printf "⇒ Download requirements: "
@ -135,3 +152,4 @@ help:
clean: clean:
rm -rf vendor rm -rf vendor
rm -rf $(BIN) rm -rf $(BIN)
rm -rf $(RELEASE)