mykiwi/mykiwi.blogpublic Fork 0
93492015ccd3091bb33a32f13ef4c29d91cfec9c
Commits
Clone
git clone https://git.rickub.com/mykiwi/mykiwi.blog.git
git clone ssh://git@rickub.com/mykiwi/mykiwi.blog.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Makefile · 46 lines · 1.7 KBMakefile Blame HistoryRaw
Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago1.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.
5ifneq (,$(wildcard .env))
6include .env
7export
8endif
9
Derive Makefile and Terraform language sets from one file 9349201 Romain Gautier 7h ago10# 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.
14LANGS := $(shell cat languages.txt)
Parallelize make deploy across languages 47c5f42 Romain Gautier 7h ago15
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 ago19.PHONY: help dev build serve infra-plan infra-apply deploy clean
20
21help:
22 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
23
24dev: ## Drop into the Hugo dev shell (hugo, dart-sass)
25 nix develop
26
27build: ## Build the site (all languages) into ./result
28 nix build
29
30serve: ## Run the Hugo dev server with live reload
Fix make serve to point Hugo at blog/ a74fe0a Romain Gautier 9h ago31 nix develop --command hugo server --source blog
Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago32
33infra-plan: ## Show what infra-apply would change on Cloudflare
34 nix run .#infra -- plan
35
36infra-apply: ## Apply infra/ changes to Cloudflare
37 nix run .#infra -- apply
38
Parallelize make deploy across languages 47c5f42 Romain Gautier 7h ago39deploy: 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
42deploy-%: ## 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 ago44
45clean: ## Remove build outputs
46 rm -rf result blog/public blog/resources