.PHONY: default build clean release require_clean_git -include .env VERSION=20230411 IMAGENAME=dnsmasq REPO=docker.io/bardak SHELL := /bin/bash default: build require_clean_git: git update-index -q --ignore-submodules --refresh git diff-files --quiet --ignore-submodules git diff-index --cached --quiet --ignore-submodules HEAD -- @status=$$(git status --porcelain); \ if test "x$${status}" = x; then \ echo "No files" \ else \ echo "Untracked files" \ exit 1 \ fi build: podman build --build-arg VERSION=$(VERSION) --tag ${REPO}/${IMAGENAME}:$(VERSION) . clean: podman image rm ${REPO}/${IMAGENAME}:$(VERSION) release: require_clean_git build $(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/sbin/dnsmasq --version)) git tag -a v$(VERSION) -m "${TMP_MESSAGE}" git push origin v$(VERSION) podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)