@@ -11,6 +11,17 @@ LATEST_VERSION=14-3.3
1111do_default =true
1212do_alpine =true
1313
14+ # There are multiple workflows in the .github/workflows/*
15+ # The default WORKFLOW is the main.yml ( amd64 ) but can be overriden via environment variables.
16+
17+ WORKFLOW ?= main
18+ TAG_POSTFIX =
19+
20+ # IF this is not the 'main' workflow THEN We add special image tag postfix. ( -experimental )
21+ ifneq ($(WORKFLOW ) ,main)
22+ TAG_POSTFIX =-experimental
23+ endif
24+
1425# The following logic evaluates VERSION and VARIANT variables that may have
1526# been previously specified, and modifies the "do" flags depending on the values.
1627# The VERSIONS variable is also set to contain the version(s) to be processed.
@@ -76,11 +87,11 @@ update:
7687define build-version
7788build-$1:
7889ifeq ($(do_default ) ,true)
79- $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1
90+ $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)$(TAG_POSTFIX) $1
8091endif
8192ifeq ($(do_alpine ) ,true)
8293ifneq ("$(wildcard $1/alpine) ","")
83- $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
94+ $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine$(TAG_POSTFIX) $1/alpine
8495endif
8596endif
8697endef
@@ -99,11 +110,11 @@ test: $(foreach version,$(VERSIONS),test-$(version))
99110define test-version
100111test-$1: test-prepare build-$1
101112ifeq ($(do_default ) ,true)
102- $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)
113+ $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)$(TAG_POSTFIX)
103114endif
104115ifeq ($(do_alpine ) ,true)
105116ifneq ("$(wildcard $1/alpine) ","")
106- $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine
117+ $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine$(TAG_POSTFIX)
107118endif
108119endif
109120endef
@@ -113,7 +124,7 @@ $(foreach version,$(VERSIONS),$(eval $(call test-version,$(version))))
113124# ## RULES FOR TAGGING ###
114125
115126tag-latest : $(BUILD_LATEST_DEP )
116- $(DOCKER ) image tag $(REPO_NAME ) /$(IMAGE_NAME ) :$(LATEST_VERSION ) $(REPO_NAME ) /$(IMAGE_NAME ) :latest
127+ $(DOCKER ) image tag $(REPO_NAME ) /$(IMAGE_NAME ) :$(LATEST_VERSION ) $(REPO_NAME ) /$(IMAGE_NAME ) :latest$( TAG_POSTFIX )
117128
118129
119130# ## RULES FOR PUSHING ###
@@ -123,24 +134,26 @@ push: $(foreach version,$(VERSIONS),push-$(version)) $(PUSH_DEP)
123134define push-version
124135push-$1: test-$1
125136ifeq ($(do_default ) ,true)
126- $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)
137+ $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)$(TAG_POSTFIX)
127138endif
128139ifeq ($(do_alpine ) ,true)
129140ifneq ("$(wildcard $1/alpine) ","")
130- $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine
141+ $(DOCKER) image push $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine$(TAG_POSTFIX)
131142endif
132143endif
133144endef
134145$(foreach version,$(VERSIONS),$(eval $(call push-version,$(version))))
135146
136147push-latest : tag-latest $(PUSH_LATEST_DEP )
137- $(DOCKER ) image push $(REPO_NAME ) /$(IMAGE_NAME ) :latest
138- @$(DOCKER ) run -v " $( PWD) " :/workspace \
148+ $(DOCKER ) image push $(REPO_NAME ) /$(IMAGE_NAME ) :latest$(TAG_POSTFIX )
149+
150+ ifeq ($(WORKFLOW),main)
151+ @$(DOCKER) run -v "$(PWD)":/workspace \
139152 -e DOCKERHUB_USERNAME='$(DOCKERHUB_USERNAME)' \
140153 -e DOCKERHUB_PASSWORD='$(DOCKERHUB_ACCESS_TOKEN)' \
141154 -e DOCKERHUB_REPOSITORY='$(REPO_NAME)/$(IMAGE_NAME)' \
142155 -e README_FILEPATH='/workspace/README.md' $(DOCKERHUB_DESC_IMG)
143-
156+ endif
144157
145158.PHONY : build all update test-prepare test tag-latest push push-latest \
146159 $(foreach version,$(VERSIONS),build-$(version)) \
0 commit comments