levineuwirth.org/Makefile

33 lines
838 B
Makefile

.PHONY: build deploy watch clean dev
# Source .env for GITHUB_TOKEN and GITHUB_REPO if it exists.
# .env format: KEY=value (one per line, no `export` prefix, no quotes needed).
-include .env
export
build:
@git add content/
@git diff --cached --quiet || git commit -m "auto: $$(date -u +%Y-%m-%dT%H:%M:%SZ)"
cabal run site -- build
pagefind --site _site
> IGNORE.txt
deploy: build
@if [ -z "$(GITHUB_TOKEN)" ] || [ -z "$(GITHUB_REPO)" ]; then \
echo "Skipping push: set GITHUB_TOKEN and GITHUB_REPO in .env"; \
else \
git push "https://$(GITHUB_TOKEN)@github.com/$(GITHUB_REPO).git" main; \
fi
rsync -avz --delete _site/ vps:/var/www/levineuwirth.org/
watch:
cabal run site -- watch
clean:
cabal run site -- clean
dev:
cabal run site -- clean
cabal run site -- build
python3 -m http.server 8000 --directory _site