-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
27 lines (20 loc) · 612 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
MSG?=Generate site
BASEDIR=$(CURDIR)
OUTPUTDIR=$(BASEDIR)/public
GITHUB_PAGES_BRANCH=gh-pages
publish: clean build
build:
hugo
touch $(OUTPUTDIR)/.nojekyll
clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
git worktree prune
rm -rf $(BASEDIR)/.git/worktrees/public/
echo "Checking out gh-pages branch into output directory"
git worktree add -B gh-pages $(OUTPUTDIR) origin/$(GITHUB_PAGES_BRANCH)
echo "Removing existing files"
rm -rf $(OUTPUTDIR)/*
github: publish
cd $(OUTPUTDIR) && git add --all && git commit -m "$(MSG)"
git push origin $(GITHUB_PAGES_BRANCH)
.PHONY: publish clean github