From dc7aa694b843baa02baaf2ec291b594230db96ef Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 5 Feb 2021 16:51:20 +0300 Subject: [PATCH 1/2] Update Makefile and targets - add `help.mk` to show information about all targets - update Makefile Signed-off-by: Evgeniy Kulikov --- Makefile | 13 ++++++++++++- help.mk | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 help.mk diff --git a/Makefile b/Makefile index db412f2..b9aa6c7 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +-include .env +-include help.mk + VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2) @@ -8,6 +11,8 @@ B=\033[0;1m G=\033[0;92m R=\033[0m +.PHONY: version deps image publish + # Show current version version: @echo "Current version: $(VERSION)-$(GRPC_VERSION)" @@ -21,6 +26,7 @@ deps: @printf "${B}${G}⇒ Store vendor localy${R}: " @go mod vendor && echo OK || (echo fail && exit 2) +# Build docker image image: VERSION?= image: deps @echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}" @@ -29,9 +35,14 @@ image: deps -f Dockerfile \ -t $(HUB_IMAGE)-http-gate:$(VERSION) . +# Publish docker image +publish: + @echo "${B}${G}⇒ publish docker image ${R}" + @docker push $(HUB_IMAGE)-http-gate:$(VERSION) + .PHONY: dev -# v1.24.0 v1.25.1 v1.26.0 v1.27.1 +# Build development docker images dev: VERSIONS?=$(GRPC_VERSION) dev: @echo "=> Build multiple images for $(VERSIONS)"; \ diff --git a/help.mk b/help.mk new file mode 100644 index 0000000..c065ec8 --- /dev/null +++ b/help.mk @@ -0,0 +1,11 @@ +.PHONY: help + +# Show this help prompt +help: + @echo ' Usage:' + @echo '' + @echo ' make ' + @echo '' + @echo ' Targets:' + @echo '' + @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq From 3b8d684e7c0666d7e2575d5cbb91ffda48ad4117 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 5 Feb 2021 17:13:37 +0300 Subject: [PATCH 2/2] Update README Signed-off-by: Evgeniy Kulikov --- Makefile | 2 +- README.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b9aa6c7..0ec592e 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ R=\033[0m version: @echo "Current version: $(VERSION)-$(GRPC_VERSION)" -# Make sure that all files added to commit +# Check and ensure dependencies deps: @printf "${B}${G}⇒ Ensure vendor${R}: " @go mod tidy -v && echo OK || (echo fail && exit 2) diff --git a/README.md b/README.md index 0a9831b..9d704f3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,23 @@ NeoFS HTTP Gate is example of tool that provides basic interactions with NeoFS. You can download files from NeoFS Network using NeoFS Gate. +## Notable make targets + +``` + Usage: + + make + + Targets: + + deps Check and ensure dependencies + dev Build development docker images + help Show this help prompt + image Build docker image + publish Publish docker image + version Show current version +``` + ## Install ```go get -u github.com/nspcc-dev/neofs-http-gate```