Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (50 loc) · 1.48 KB
/
Copy pathMakefile
File metadata and controls
52 lines (50 loc) · 1.48 KB
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
49
50
51
52
.PHONY: save
save:
@echo "====> saving changes"
@git checkout -b save
@echo "====> generating SUMMARY.md"
@python3 summary_generator.py
@echo "====> rebuilding the book.."
mdbook build
@echo "====> done"
@echo "====> adding tracked files"
@git add -u
@echo "====> adding new recipes"
@git add src/*
@echo "====> committing changes"
@git commit -m 'Auto-commit on $(shell date)'
@echo "====> pushing book source to github.com/troyerta/recipes/"
git push origin HEAD:master
@echo "====> resetting workspace"
@git checkout origin/master
@git delbr master
git checkout -b master
@git delbr save
@echo "====> Done!"
.PHONY: deploy
deploy: book
@echo "====> deploying github.com/troyerta/recipes/"
@git checkout -b temp-deploy-branch
@echo "====> building a temporary worktree on gh-pages branch"
@git worktree add ./tmp_book origin/gh-pages
@echo "====> deleting the old book"
@rm -rf ./tmp_book/*
@echo "====> copying over the new book"
@cp -rp book/* ./tmp_book/
@echo "====> committing and pushing new book to gh-pages branch"
cd ./tmp_book && \
git checkout -b tmp && \
git add -A && \
git commit -m "deployed on $(shell date) by ${USER}" && \
git push origin HEAD:gh-pages && \
git checkout origin/gh-pages && \
git delbr tmp
@echo "====> pruning the worktree"
@rm -rf ./tmp_book
@git worktree prune
@echo "====> resetting the workspace"
@git checkout origin/master
@git delbr temp-deploy-branch
@git delbr master
@git checkout -b master
@echo "====> Done!"