From 36e571bc182098d598515b9d018188e4d5946e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Sun, 21 Jan 2024 17:51:06 +0100 Subject: [PATCH] Use ${branch}-dirty as image tag when repository is not clean --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c749641..c5c1e5e 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,14 @@ IMAGE_REGISTRY := docker.io IMAGE_NAMESPACE := hectorm IMAGE_PROJECT := qemu-reactos IMAGE_NAME := $(IMAGE_REGISTRY)/$(IMAGE_NAMESPACE)/$(IMAGE_PROJECT) -IMAGE_GIT_TAG := $(shell '$(GIT)' tag -l --contains HEAD 2>/dev/null) -IMAGE_GIT_SHA := $(shell '$(GIT)' rev-parse HEAD 2>/dev/null) -IMAGE_VERSION := $(if $(IMAGE_GIT_TAG),$(IMAGE_GIT_TAG),$(if $(IMAGE_GIT_SHA),$(IMAGE_GIT_SHA),nil)) +ifeq ($(shell '$(GIT)' status --porcelain 2>/dev/null),) + IMAGE_GIT_TAG := $(shell '$(GIT)' tag --list --contains HEAD 2>/dev/null) + IMAGE_GIT_SHA := $(shell '$(GIT)' rev-parse --verify --short HEAD 2>/dev/null) + IMAGE_VERSION := $(if $(IMAGE_GIT_TAG),$(IMAGE_GIT_TAG),$(if $(IMAGE_GIT_SHA),$(IMAGE_GIT_SHA),nil)) +else + IMAGE_GIT_BRANCH := $(shell '$(GIT)' symbolic-ref --short HEAD 2>/dev/null) + IMAGE_VERSION := $(if $(IMAGE_GIT_BRANCH),$(IMAGE_GIT_BRANCH)-dirty,nil) +endif IMAGE_BUILD_OPTS :=