From 55a2505a71ddc6d19b67508d354e8a4514714b64 Mon Sep 17 00:00:00 2001 From: mms Date: Mon, 15 Apr 2024 15:56:51 +0200 Subject: chore: makefile and gzip: --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b61a68b --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +.PHONY: local build compress upload clean +build: + hugo +compress: + @dir_path="./public"; \ + ignored=0; \ + compressed=0; \ + for file in $$(find "$$dir_path" -type f ! -name "*.gz"); do \ + gzip -9nc "$$file" > "$${file}.test.gz"; \ + if cmp -s "$${file}.gz" "$${file}.test.gz"; then \ + rm "$${file}.test.gz"; \ + ignored=$$((ignored+1)); \ + else \ + mv "$${file}.test.gz" "$${file}.gz"; \ + compressed=$$((compressed+1)); \ + echo "Compressed: $$file.gz"; \ + fi; \ + done; \ + echo "Ignored $$ignored files. Total compressed: $$compressed." +upload: + source_dir="public/"; \ + dest_server="mms@michal.sapka.me:/var/www/htdocs/michal.sapka.me"; \ + rsync -irtvzP --delete "$$source_dir" "$$dest_server"; \ + echo "Rsync completed." + +clean: + rm -r public +deploy: build compress upload + + -- cgit v1.2.3