diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 30 |
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 + + |