cleaned up git clean checks
This commit is contained in:
parent
04ec1f51d8
commit
58a2f63bbe
27
Makefile
27
Makefile
@ -1,13 +1,25 @@
|
||||
.PHONY: default build clean
|
||||
.PHONY: default build clean release require_clean_git
|
||||
|
||||
|
||||
-include .env
|
||||
|
||||
VERSION=0.15.1-1.2
|
||||
IMAGENAME=restic
|
||||
REPO=docker.io/bardak
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
guard:
|
||||
@ if [ -z "$(git status --porcelain)" ]; then echo "git repo not clean"; exit 1; fi
|
||||
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
|
||||
|
||||
@ -17,5 +29,10 @@ build:
|
||||
clean:
|
||||
podman image rm docker.io/bardak/restic:$(VERSION)
|
||||
|
||||
push: guard build
|
||||
podman push --creds $(USERNAME):$(PASSWORD) 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 "${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
|
||||
|
Loading…
Reference in New Issue
Block a user