~seirdy/seirdy.one

ref: b9e4be50f5e2b543df8e834ff2bc7893e084fd09 seirdy.one/Makefile -rw-r--r-- 1.6 KiB
b9e4be50Rohan Kumar Metadata: description + cache-bust manifest icons 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
CSS_DIR = themes/etch-custom/assets/css

USER = deploy@seirdy.one
WWW_ROOT = /var/www/seirdy.one
GEMINI_ROOT = /srv/gemini/seirdy.one

WWW_RSYNC_DEST = $(USER):$(WWW_ROOT)
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)

OUTPUT_DIR = public

RSYNCFLAGS += -rlvz --zc=zstd

# .hintrc-local for linting local files
# same as regular .hintrc but with a different connector.
.hintrc-local: .hintrc
	jq --tab '.connector .name = "local" | del(.connector .options)' <.hintrc >.hintrc-local

clean:
	rm -rf $(OUTPUT_DIR) .hintrc-local

lint-css:
	stylelint $(CSS_DIR)/main.css $(CSS_DIR)/dark.css
	csslint $(CSS_DIR)

lint: lint-css hugo .hintrc-local
	hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)

check-links: hugo
	lychee --verbose $(find public -type f -name '*.html' -o -name '*.gmi' -o -name '*.txt')

test: lint check-links

hugo:
	hugo --gc

build: hugo
# gzip_static + max zopfli compression
ifndef NO_GZIP_STATIC
	find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' -o -name '*.webmanifest' \
		| grep -v gemini \
		| xargs zopfli --i50 --gzip
endif


deploy: build
	rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
	rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.txt $(GEMINI_RSYNC_DEST)/ --delete
	rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml

all: clean test deploy

.PHONY: clean lint-css lint check-links test hugo build deploy all