Skip to content

Commit 3757c6c

Browse files
ycmjasonyyx990803
authored andcommitted
docs: improved instructions on github deployment (#173)
1 parent c1bbd05 commit 3757c6c

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/guide/deploy.md

+26-8
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,45 @@ The following guides assumes you are placing your docs inside the `docs` directo
44

55
## GitHub Pages
66

7-
1. Set `base` in `.vuepress/config.js` to your repository's name. For example, if your repository is `https://github.com/foo/bar`, the deployed pages will be available at `https://foo.github.io/bar`. In this case, you should set `base` to `"/bar/"`.
7+
1. Set correct `base` in `.vuepress/config.js`.
88

9-
2. Inside your project, run:
9+
If you are deploying to `https://<USERNAME>.github.io/`, you can omit `base` as it defaults to `"/"`.
10+
11+
If your are deploying to `https://<USERNAME>.github.io/<REPO>/`, (i.e. your repository is at `https://github.com/<USERNAME>/REPO>`), set `base` to `"/<REPO>/"`.
12+
13+
2. Inside your project, create `deploy.sh` with the following content (with highlighted lines uncommented appropriately) and run it to deploy:
14+
15+
::: tip
16+
You can also run this script in your CI setup to enable automatic deployment on each push.
17+
:::
18+
19+
``` bash{13,20,23}
20+
#!/usr/bin/env sh
21+
22+
# abort on errors
23+
set -e
1024
11-
``` bash
1225
# build
1326
vuepress build docs
1427
1528
# navigate into the build output directory
1629
cd docs/.vuepress/dist
1730
31+
# if you are deploying to a custom domain
32+
# echo 'www.example.com' > CNAME
33+
1834
git init
1935
git add -A
2036
git commit -m 'deploy'
2137
22-
# push to the gh-pages branch of your repo.
23-
# replace <USERNAME>/<REPO> with your info
24-
git push -f [email protected]:<USERNAME>/<REPO>.git master:gh-pages
25-
```
38+
# if you are deploying to https://<USERNAME>.github.io
39+
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
2640
27-
You can run this script in your CI setup to enable automatic deployment on each push.
41+
# if you are deploying to https://<USERNAME>.github.io/<REPO>
42+
# git push -f [email protected]:<USERNAME>/<REPO>.git master:gh-pages
43+
44+
cd -
45+
```
2846

2947
## Netlify
3048

0 commit comments

Comments
 (0)