summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormms <michal@sapka.me>2024-04-15 15:56:51 +0200
committermms <michal@sapka.me>2024-04-15 15:56:51 +0200
commit55a2505a71ddc6d19b67508d354e8a4514714b64 (patch)
tree347b8437df8cb3a82bb773170d322d2d30fe50ff /Makefile
parent5c1d588d442368f08d175f037ddb5b2fce666f58 (diff)
chore: makefile and gzip:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
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
+
+