Skip to content

Commit

Permalink
workflow: auto-generate latest, v3, v3.1 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Feb 5, 2024
1 parent aec4cc9 commit 99ffabc
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 99ffabc

Please sign in to comment.