From 99ffabcb3887a5cad6fa1495e26587ea036f8f2e Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 5 Feb 2024 20:19:22 +0100 Subject: [PATCH] workflow: auto-generate latest, v3, v3.1 tags --- Makefile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fc6bea7..0cccd8e 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,20 @@ ifeq (,$(TAG)) TAG := $(VERSION) endif +LATEST_TAGS := $(basename $(TAG)) latest +LATEST_TAGS += $(basename $(LATEST_TAGS)) +LATEST_TAGS += $(basename $(LATEST_TAGS)) +LATEST_TAGS := $(sort $(LATEST_TAGS)) + ifneq (,$(wildcard .env.mk)) include .env.mk endif +define newline + + +endef + # Architectures arm32v7-%: DOCKER_ARCH=arm32v7 @@ -54,15 +64,19 @@ dockerhub: $(addsuffix -dockerhub, $(BUILD_ARCHS)) make dockerhub-manifest %-dockerhub-latest-release: %-dockerhub-pull - docker tag $(REGISTRY):$(TAG)-$* $(REGISTRY):latest-$* - docker push $(REGISTRY):latest-$* + $(foreach latest_tag,$(LATEST_TAGS), \ + docker tag $(REGISTRY):$(TAG)-$* $(REGISTRY):$(latest_tag)-$* $(newline) \ + docker push $(REGISTRY):$(latest_tag)-$* $(newline) \ + ) dockerhub-latest-release: $(addsuffix -dockerhub-latest-release, $(BUILD_ARCHS)) # This requires `echo '{"experimental":"enabled"}' > ~/.docker/config.json` -rm -rf ~/.docker/manifests - docker manifest create $(REGISTRY):latest \ - $(addprefix $(REGISTRY):$(TAG)-, $(BUILD_ARCHS)) - docker manifest push $(REGISTRY):latest + $(foreach latest_tag,$(LATEST_TAGS), \ + docker manifest create $(REGISTRY):$(latest_tag) \ + $(addprefix $(REGISTRY):$(TAG)-, $(BUILD_ARCHS)) $(newline) \ + docker manifest push $(REGISTRY):$(latest_tag) $(newline) \ + ) # Client Binaries