From 5e0f54eb74b947a065b258f51962c1890a0a72bb Mon Sep 17 00:00:00 2001 From: Wen Kokke Date: Fri, 23 Oct 2020 11:35:48 +0200 Subject: [PATCH] Added command for publishing PLFA. --- Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Makefile b/Makefile index f8cbe690..925f190c 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,40 @@ list: @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' + +######################################## +# Publish PLFA +######################################## + +.PHONY: publish +publish: setup-check-rsync + @echo "Cleaning up..." + make clean + @echo "Building site..." + make build + @echo "Testing site..." + make test + @echo "Creating web branch..." + git fetch --all + git checkout -b web --track origin/web + rsync -a \ + --filter='P _site/' \ + --filter='P _cache/' \ + --filter='P .git/' \ + --filter='P .gitignore' \ + --filter='P .stack-work' \ + --filter='P CNAME' \ + --delete-excluded \ + _site/ . + git add -A + @echo "Publishing web branch..." + git commit -m "Publish." + git push origin web:web + @echo "Deleting web branch..." + git checkout dev + git branch -D web + + ################################################################################# # Setup dependencies ################################################################################# @@ -135,6 +169,14 @@ ifeq (,$(wildcard $(shell which epubcheck))) @echo "See: https://github.com/w3c/epubcheck" endif +.PHONY: setup-check-rsync +setup-check-rsync: +ifeq (,$(wildcard $(shell which rsync))) + @echo "The command you called requires rsync" + @echo "See: https://rsync.samba.org/" + @exit 1 +endif + .PHONY: setup-install-htmlproofer setup-install-htmlproofer: setup-check-gem ifeq (,$(wildcard $(shell which htmlproofer)))