Skip to content

Commit

Permalink
Merge pull request #85 from ryantate13/master
Browse files Browse the repository at this point in the history
automatically publish v1.0.0-beta tag when publishing suffixed tag
  • Loading branch information
alok87 authored Jun 29, 2020
2 parents b1d9b7f + d537613 commit 1202d83
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ BASEIMAGE ?= gcr.io/distroless/static

IMAGE := $(REGISTRY)/$(BIN)
TAG := $(VERSION)
BETA := v1.0-beta

ifneq (,$(findstring v1.0,$(TAG))$(findstring -beta,$(TAG)))
PUBLISH_TAGS := $(IMAGE):$(TAG) $(IMAGE):$(BETA)
else
PUBLISH_TAGS := $(IMAGE):$(TAG)
endif

define \n


endef

BUILD_IMAGE ?= golang:1.14.2-alpine
TEST_IMAGE ?= practodev/golang:1.14.2-alpine-test
Expand Down Expand Up @@ -140,18 +152,18 @@ container: .container-$(DOTFILE_IMAGE) say_container_name
-e 's|{ARG_OS}|$(OS)|g' \
-e 's|{ARG_FROM}|$(BASEIMAGE)|g' \
Dockerfile.in > .dockerfile-$(OS)_$(ARCH)
@docker build -t $(IMAGE):$(TAG) -f .dockerfile-$(OS)_$(ARCH) .
@docker build $(foreach T, $(PUBLISH_TAGS), -t $(T)) -f .dockerfile-$(OS)_$(ARCH) .
@docker images -q $(IMAGE):$(TAG) > $@

say_container_name:
@echo "container: $(IMAGE):$(TAG)"

push: .push-$(DOTFILE_IMAGE) say_push_name
.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE)
@docker push $(IMAGE):$(TAG)
@$(foreach T, $(PUBLISH_TAGS), docker push $(T) $(\n))

say_push_name:
@echo "pushed: $(IMAGE):$(TAG)"
@$(foreach T, $(PUBLISH_TAGS), echo "pushed: $(T)" $(\n))

manifest-list: push
platforms=$$(echo $(ALL_PLATFORMS) | sed 's/ /,/g'); \
Expand Down

0 comments on commit 1202d83

Please sign in to comment.