Use separate Makefile target for pushing to registry

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2024-10-24 17:26:50 +03:00
parent 976af216c6
commit 22d46bfb6f
2 changed files with 4 additions and 3 deletions

View file

@ -34,7 +34,7 @@ jobs:
if: steps.changed.outputs.any_changed == 'true'
- name: Push image to OCI registry
run: make ${{matrix.tag}} PUSH=y
run: make push-${{matrix.tag}}
if: >-
steps.changed.outputs.any_changed == 'true'
&& github.ref == 'refs/heads/master'

View file

@ -13,8 +13,9 @@ $(TAGS):
buildah images
cd $@ && buildah bud --tag $(IMAGE):$@ .
buildah images
ifneq (,$(PUSH))
PUSH=$(foreach tag,$(TAGS),push-$(tag))
$(PUSH):
echo $$REGISTRY_PASSWORD | buildah login --username $(REGISTRY_USER) --password-stdin $(REGISTRY)
buildah push --rm $(IMAGE):$@ docker://$(IMAGE):$@
buildah logout
endif