Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatically publish v1.0.0-beta tag when publishing suffixed tag #85

Merged
merged 2 commits into from
Jun 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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