diff --git a/book-example/src/continuous-integration.md b/book-example/src/continuous-integration.md index be47a2fc..a0f2e557 100644 --- a/book-example/src/continuous-integration.md +++ b/book-example/src/continuous-integration.md @@ -54,3 +54,35 @@ deploy: ``` That's it! + +### Deploying to GitHub Pages manually + +If you're CI doesn't support a GitHub pages, or you're deploying somewhere else +with GitHub pages like integration, *note: you may want to use different tmp dirs*: + +```console +$> git worktree add /tmp/book gh-pages +$> mdbook build +$> rm -rf /tmp/book/* # this won't delete the .git directory +$> cp -rp book/* /tmp/book/ +$> cd /tmp/book +$> git add -A +$> git commit 'new book message' +$> git push origin gh-pages +$> cd - +``` + +Or put this into a Makefile rule: + +```makefile +.PHONY: deploy +deploy: book + @echo "====> deploying to github" + git worktree add /tmp/book gh-pages + rm -rf /tmp/book/* + cp -rp book/* /tmp/book/ + cd /tmp/book && \ + git add -A && \ + git commit -m "deployed on $(shell date) by ${USER}" && \ + git push origin gh-pages +```