-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (34 loc) · 1.57 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
.PHONY: build-theme build-landing deploy deploy-theme deploy-landing check
COMMIT = $(shell git rev-parse --short HEAD)
# You may need to install jq for this to work!
VERSION = $(shell cat package.json | jq -r '.version')
THEME=landing
check:
@which jq > /dev/null || (echo "Error: the jq linux command is not available. Please install it first (brew install jq | apt-get install jq)." && exit 1)
build-theme:
mkdir .deploy || true
rm -rf .deploy/$(THEME)
git clone --depth 1 https://github.com/curvenote-themes/$(THEME) .deploy/$(THEME)
rm -rf .deploy/$(THEME)/public .deploy/$(THEME)/build .deploy/$(THEME)/package.json .deploy/$(THEME)/package-lock.json .deploy/$(THEME)/template.yml .deploy/$(THEME)/server.js
find template -type f -exec cp {} .deploy/$(THEME) \;
npm run prod:build
cp -r public .deploy/$(THEME)/public
cp -r build .deploy/$(THEME)/build
cp -r template.yml .deploy/$(THEME)/template.yml
cp -r template/README.md .deploy/$(THEME)/README.md
sed -i.bak "s/template/$(THEME)/g" .deploy/$(THEME)/package.json
sed -i.bak "s/VERSION/$(VERSION)/g" .deploy/$(THEME)/package.json
rm .deploy/$(THEME)/package.json.bak
cd .deploy/$(THEME) && npm install
build-landing:
make THEME=landing build-theme
deploy-theme: check
echo "Deploying $(THEME) theme to curvenote-themes/$(THEME)"
echo "Version: $(VERSION)"
make THEME=$(THEME) build-theme
cd .deploy/$(THEME) && git add .
cd .deploy/$(THEME) && git commit -m "🚀 v$(VERSION) from $(COMMIT)"
cd .deploy/$(THEME) && git push -u origin main
deploy: deploy-landing
deploy-landing:
make THEME=landing deploy-theme