git » sparkle-arcade » master » tree

[master] / Makefile

.PHONY: deploy clean check-git-clean

DIST_ITEMS := index.html styles.css blossom-blocks fairy-finder crystal-cloud-carousel moonlit-garden-match starlit-stacker
DEPLOY_TARGET ?= arsien23i2@dreamhost:tailrecursion.com/arcade/
RSYNC_FLAGS ?= -av --delete --chmod=F644,D755 --exclude='.DS_Store'

clean:
	find . -name '*.DS_Store' -delete

deploy: check-git-clean
	@if [ -z "$(DEPLOY_TARGET)" ]; then \
		echo "DEPLOY_TARGET not set"; \
		exit 1; \
	fi
	rsync $(RSYNC_FLAGS) $(DIST_ITEMS) $(DEPLOY_TARGET)
	@if [ -d .git ]; then \
		git push; \
	else \
		echo "Skipping git push (no .git directory)"; \
	fi

check-git-clean:
	@if [ ! -d .git ]; then \
		echo "Warning: not a git repository; skipping clean check."; \
	else \
		if [ -n "$$(git status --porcelain)" ]; then \
			echo 'Refusing to deploy: git worktree has uncommitted changes.'; \
			git status --short; \
			exit 1; \
		fi; \
	fi