From c9f9fc623afdf7b1038e457fce323f92c47eef5a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 2 Jul 2016 21:00:27 -0700 Subject: Add target to deploy the site to gh-pages. Build the site and commit it to the gh-pages branch, then push it. --- Makefile | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5ec4715..9fa4bbf 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,34 @@ +.PHONY: clean clean: hugo --cleanDestinationDir +.PHONY: server server: clean hugo serve --buildDrafts --buildFuture +.PHONY: deps deps: brew install hugo +.PHONY: build build: clean hugo +DEPLOY_BRANCH := gh-pages +DEPLOY_DIR := public + +.PHONY: publish publish: build - gsutil -m rsync -R _site/ gs://b.lumberjaph.net - gsutil -m acl ch -u AllUsers:R -R gs://b.lumberjaph.net/ - gsutil -m web set -m index.html -e 404.html gs://b.lumberjaph.net + git symbolic-ref HEAD refs/heads/$(DEPLOY_BRANCH) + git --work-tree $(DEPLOY_DIR) reset --mixed --quiet + git --work-tree $(DEPLOY_DIR) add --all + if git --work-tree $(DEPLOY_DIR) diff-index --quiet HEAD -- ; then \ + echo "no changes" ; \ + else \ + git --work-tree $(DEPLOY_DIR) commit -m "deploy " ; \ + git push origin $(DEPLOY_BRANCH) ; \ + fi -.PHONY: build clean server deps publish + git symbolic-ref HEAD refs/heads/master + git reset --mixed + rm rf $(DEPLOY_DIR) -- cgit v1.2.3