From 2da5b683e50da5a5b5fec62958c626c10962e66f Mon Sep 17 00:00:00 2001 From: expelledboy Anthony Jackson Date: Thu, 27 Feb 2020 00:19:16 +0200 Subject: [PATCH] Update publish to work like docker builds --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bc2000f..47e8d40 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,8 @@ IMAGE = $(REGISTRY)/$(USERNAME)/$(NAME) help: ## Print help messages @sed -n 's/^\([a-zA-Z_-]*\):.*## \(.*\)$$/\1 -- \2/p' Makefile -build: VERSION = $(shell git describe --always) build: ## Build docker image docker build -t $(IMAGE) . - docker tag $(IMAGE):latest $(IMAGE):$(VERSION) test: ## Run simple unit test docker run -d --rm \ @@ -43,9 +41,15 @@ bump: IMPACT = patch bump: npm version $(IMPACT) -publish: VERSION = $(shell git describe --always) +publish: VERSION = $(shell git describe --always | tr -d v) +publish: MINOR = $(shell echo $(VERSION) | sed -n 's/^\(.\..\).*/\1/p') publish: on-tag build ## Push docker image to $(REGISTRY) + docker tag $(IMAGE):latest $(IMAGE):$(VERSION) + docker tag $(IMAGE):latest $(IMAGE):$(MINOR) docker push $(IMAGE):$(VERSION) + docker push $(IMAGE):$(MINOR) + docker rmi $(IMAGE):$(VERSION) + docker rmi $(IMAGE):$(MINOR) docker push $(IMAGE):latest # ==