| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 1 | .DEFAULT_GOAL := help |
| 2 | |
| 3 | # CLOUDFLARE_API_TOKEN lives in .env (gitignored, copy from .env.dist) - |
| 4 | # load it into every recipe's environment, e.g. for infra-plan/infra-apply/deploy. |
| 5 | ifneq (,$(wildcard .env)) |
| 6 | include .env |
| 7 | export |
| 8 | endif |
| 9 | |
| Derive Makefile and Terraform language sets from one file 9349201 Romain Gautier 7h ago | 10 | # languages.txt is the single source of truth for the site's language set, |
| 11 | # shared with infra/main.tf - blog/hugo.toml's [languages.*] blocks are the |
| 12 | # one place it can't drive directly (Tofu has no TOML parser), so keep those |
| 13 | # in sync by hand. |
| 14 | LANGS := $(shell cat languages.txt) |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 7h ago | 15 | |
| 16 | # deploy-% targets aren't listed here: giving an instantiated pattern target |
| 17 | # (e.g. deploy-en) to .PHONY creates an explicit no-recipe rule for it, which |
| 18 | # then blocks the deploy-% pattern rule below from ever supplying a recipe. |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 19 | .PHONY: help dev build serve infra-plan infra-apply deploy clean |
| 20 | |
| 21 | help: |
| 22 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}' |
| 23 | |
| 24 | dev: ## Drop into the Hugo dev shell (hugo, dart-sass) |
| 25 | nix develop |
| 26 | |
| 27 | build: ## Build the site (all languages) into ./result |
| 28 | nix build |
| 29 | |
| 30 | serve: ## Run the Hugo dev server with live reload |
| Fix make serve to point Hugo at blog/ a74fe0a Romain Gautier 9h ago | 31 | nix develop --command hugo server --source blog |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 32 | |
| 33 | infra-plan: ## Show what infra-apply would change on Cloudflare |
| 34 | nix run .#infra -- plan |
| 35 | |
| 36 | infra-apply: ## Apply infra/ changes to Cloudflare |
| 37 | nix run .#infra -- apply |
| 38 | |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 7h ago | 39 | deploy: build ## Build the site and push it to Cloudflare Pages (all languages, in parallel) |
| 40 | $(MAKE) --no-print-directory --output-sync=target -j$(words $(LANGS)) $(addprefix deploy-,$(LANGS)) |
| 41 | |
| 42 | deploy-%: ## Deploy a single language to Cloudflare Pages, e.g. `make deploy-en` (assumes `make build` already ran) |
| 43 | nix run .#deploy -- $* |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 44 | |
| 45 | clean: ## Remove build outputs |
| 46 | rm -rf result blog/public blog/resources |