.PHONY: build deploy sign 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)" @date +%s > data/build-start.txt cabal run site -- build pagefind --site _site @if [ -d .venv ]; then \ uv run python tools/embed.py || echo "Warning: embedding failed — data/similar-links.json not updated (build continues)"; \ else \ echo "Embedding skipped: run 'uv sync' to enable similar-links (build continues)"; \ fi > IGNORE.txt @BUILD_END=$$(date +%s); \ BUILD_START=$$(cat data/build-start.txt); \ echo $$((BUILD_END - BUILD_START)) > data/last-build-seconds.txt sign: @./tools/sign-site.sh deploy: build sign @if [ -z "$(GITHUB_TOKEN)" ] || [ -z "$(GITHUB_REPO)" ]; then \ echo "Skipping GitHub 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_USER)@$(VPS_HOST):$(VPS_PATH)/ 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