summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFranck Cuny <franckcuny@gmail.com>2016-07-02 21:00:27 -0700
committerFranck Cuny <franckcuny@gmail.com>2016-07-02 21:00:27 -0700
commitc9f9fc623afdf7b1038e457fce323f92c47eef5a (patch)
treea683f1eea1051ca1f8354697b8e608c83c7dce16 /Makefile
parentAdd build target to the Makefile. (diff)
downloadlumberjaph-c9f9fc623afdf7b1038e457fce323f92c47eef5a.tar.gz
Add target to deploy the site to gh-pages.
Build the site and commit it to the gh-pages branch, then push it.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files 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)