summaryrefslogblamecommitdiff
path: root/Makefile
blob: e7428d181d83ef7d5bc8d6e5567132b08385dbd2 (plain) (tree)
1
2
3
4
5
6
7
8
9
             
      
                                  
 
              
             
                                              
 
            
     
                         
 
             


            
                       


                    
              








                                                                            
 
                                              
                         
                                                    
.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 := master
DEPLOY_DIR := public

.PHONY: publish
publish: build
	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

	git symbolic-ref HEAD refs/heads/posts
	git reset --mixed
	[ -d $(DEPLOY_DIR) ] && rm -rf $(DEPLOY_DIR)