2023-04-13 15:03:08 +00:00
|
|
|
.PHONY: default build clean release require_clean_git
|
2023-04-13 12:45:03 +00:00
|
|
|
|
|
|
|
-include .env
|
|
|
|
|
|
|
|
VERSION=20230411
|
|
|
|
IMAGENAME=dnsmasq
|
2023-04-17 17:50:21 +00:00
|
|
|
REPO=git.rre.nu/jonas
|
2023-04-13 12:45:03 +00:00
|
|
|
|
|
|
|
SHELL := /bin/bash
|
|
|
|
|
|
|
|
default: build
|
|
|
|
|
2023-04-13 15:03:08 +00:00
|
|
|
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 \
|
2023-04-13 15:08:14 +00:00
|
|
|
echo "No untracked files detected"; \
|
2023-04-13 15:03:08 +00:00
|
|
|
else \
|
2023-04-13 15:08:14 +00:00
|
|
|
echo "Untracked files detected" >&2; \
|
2023-04-13 15:09:44 +00:00
|
|
|
exit 1; \
|
2023-04-13 15:03:08 +00:00
|
|
|
fi
|
2023-04-13 12:45:03 +00:00
|
|
|
|
2023-04-13 15:06:25 +00:00
|
|
|
|
2023-04-13 12:45:03 +00:00
|
|
|
build:
|
|
|
|
podman build --build-arg VERSION=$(VERSION) --tag ${REPO}/${IMAGENAME}:$(VERSION) .
|
|
|
|
|
2023-04-13 15:03:08 +00:00
|
|
|
clean:
|
2023-04-13 12:45:03 +00:00
|
|
|
podman image rm ${REPO}/${IMAGENAME}:$(VERSION)
|
|
|
|
|
2023-04-13 15:03:08 +00:00
|
|
|
release: require_clean_git build
|
2023-04-13 14:19:02 +00:00
|
|
|
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/sbin/dnsmasq --version))
|
2023-04-17 12:20:39 +00:00
|
|
|
git tag -a v$(VERSION) -m "dnsmasq version: ${TMP_MESSAGE}"
|
2023-04-13 12:45:03 +00:00
|
|
|
git push origin v$(VERSION)
|
2023-04-17 08:17:50 +00:00
|
|
|
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
2023-04-13 12:45:03 +00:00
|
|
|
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
2023-04-17 08:17:50 +00:00
|
|
|
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|