restic/Makefile
2023-04-17 14:21:03 +02:00

39 lines
1.1 KiB
Makefile

.PHONY: default build clean release require_clean_git
-include .env
VERSION=20230411
IMAGENAME=restic
REPO=docker.io/bardak
SHELL := /bin/bash
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 untracked files detected"; \
else \
echo "Untracked files detected" >&2; \
exit 1; \
fi
default: build
build:
podman build --build-arg VERSION=$(VERSION) --tag docker.io/bardak/restic:$(VERSION) .
clean:
podman image rm docker.io/bardak/restic:$(VERSION)
release: require_clean_git build
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/bin/restic --version))
git tag -a v$(VERSION) -m "restic version: ${TMP_MESSAGE}"
git push origin v$(VERSION)
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest