Skip to content

Commit 7f3a0ff

Browse files
authored
Merge pull request #886 from bluejekyll/master
add docs for publishing to github pages manually
2 parents f01fe85 + aea317e commit 7f3a0ff

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

book-example/src/continuous-integration.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ deploy:
5454
```
5555

5656
That's it!
57+
58+
### Deploying to GitHub Pages manually
59+
60+
If your CI doesn't support GitHub pages, or you're deploying somewhere else
61+
with integrations such as Github Pages:
62+
*note: you may want to use different tmp dirs*:
63+
64+
```console
65+
$> git worktree add /tmp/book gh-pages
66+
$> mdbook build
67+
$> rm -rf /tmp/book/* # this won't delete the .git directory
68+
$> cp -rp book/* /tmp/book/
69+
$> cd /tmp/book
70+
$> git add -A
71+
$> git commit 'new book message'
72+
$> git push origin gh-pages
73+
$> cd -
74+
```
75+
76+
Or put this into a Makefile rule:
77+
78+
```makefile
79+
.PHONY: deploy
80+
deploy: book
81+
@echo "====> deploying to github"
82+
git worktree add /tmp/book gh-pages
83+
rm -rf /tmp/book/*
84+
cp -rp book/* /tmp/book/
85+
cd /tmp/book && \
86+
git add -A && \
87+
git commit -m "deployed on $(shell date) by ${USER}" && \
88+
git push origin gh-pages
89+
```

0 commit comments

Comments
 (0)