From 22d46bfb6f2aa3403f84e2c54ebdba52b0fbfa06 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 24 Oct 2024 17:26:50 +0300 Subject: [PATCH] Use separate Makefile target for pushing to registry Signed-off-by: Vitaliy Potyarkin --- .forgejo/workflows/build.yml | 2 +- Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 9193d6237..e37f8026f 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -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' diff --git a/Makefile b/Makefile index cd2456a85..ab333906c 100644 --- a/Makefile +++ b/Makefile @@ -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