-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
48 lines (34 loc) · 1.19 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# type `make help` to see all options
# To build and test the website locally, simply do:
# $ hugo
# $ hugo server
TARGET ?= upstream
BASEURL ?=
WORKTREETARGET = "$(TARGET)/gh-pages"
ifdef BASEURL
BASEURLARG=-b $(BASEURL)
endif
all: build
.PHONY: serve html clean deploy help
.SILENT: # remove this to see the commands executed
public: ## create a worktree branch in the public directory
git worktree add -B gh-pages public $(WORKTREETARGET)
rm -rf public/*
html: public ## build the website in ./public
hugo $(BASEURLARG)
touch public/.nojekyll
echo data-apis.org > public/CNAME
public/.nojekyll: html
clean: ## remove the build artifacts, mainly the "public" directory
rm -rf public
git worktree prune
rm -rf .git/worktrees/public
deploy: public/.nojekyll ## push the built site to the gh-pages of this repo
cd public && git add --all && git commit -m"Publishing to gh-pages"
@echo pushint to $(TARGET) gh-pages
git push $(TARGET) gh-pages
# Add help text after each target name starting with '\#\#'
help: ## Show this help.
@echo "\nHelp for this makefile"
@echo "Possible commands are:"
@grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/\(.*\):.*##\(.*\)/ \1: \2/'