Skip to content

Commit 145332b

Browse files
jenkey2011ulivz
andauthored
docs: add a method to deploy vuepress site with github actions (#2179)
* docs: add a method to deploy vuepress site with github actions * chore: tweaks * chore: tweaks * chore: tweaks * chore: add link * chore: add link * chore: add link * chore: add cn doc Co-authored-by: ULIVZ <472590061@qq.com>
1 parent 2345902 commit 145332b

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

packages/docs/docs/guide/deploy.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ cd -
5656
You can also run the above script in your CI setup to enable automatic deployment on each push.
5757
:::
5858

59+
### GitHub Pages and GitHub Actions
60+
61+
1. [Create a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token);
62+
2. Create [encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) under your repository;
63+
3. Create a `.yml` or `.yaml` file in the `.github/workflows` directory in the root of your repository. e.g:`vuepress-deploy.yml`:
64+
65+
```yml
66+
name: Build and Deploy
67+
on: [push]
68+
jobs:
69+
build-and-deploy:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@master
74+
75+
- name: vuepress-deploy
76+
uses: jenkey2011/vuepress-deploy@master
77+
env:
78+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
79+
TARGET_REPO: username/repo
80+
TARGET_BRANCH: master
81+
BUILD_SCRIPT: yarn && yarn build
82+
BUILD_DIR: docs/.vuepress/dist
83+
CNAME: https://www.xxx.com
84+
```
85+
86+
For more information, you can checkout [jenkey2011/vuepress-deploy](https://github.com/jenkey2011/vuepress-deploy/).
87+
5988
### GitHub Pages and Travis CI
6089
6190
1. Set the correct `base` in `docs/.vuepress/config.js`.

packages/docs/docs/zh/guide/deploy.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,35 @@ cd -
8181
你可以在你的持续集成的设置中,设置在每次 push 代码时自动运行上述脚本。
8282
:::
8383

84+
### GitHub Pages and Github Actions
85+
86+
1. 创建 [Github access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token);
87+
2. 在你 github 仓库下,创建一个 [secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) ,填入刚创建的 `token`
88+
3. 在项目根目录下的 `.github/workflows` 目录(没有的话,请手动创建一个)下创建一个 `.yml` 或者 `.yaml` 文件,如:`vuepress-deploy.yml`;
89+
90+
```yml
91+
name: Build and Deploy
92+
on: [push]
93+
jobs:
94+
build-and-deploy:
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@master
99+
100+
- name: vuepress-deploy
101+
uses: jenkey2011/vuepress-deploy@master
102+
env:
103+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
104+
TARGET_REPO: username/repo
105+
TARGET_BRANCH: master
106+
BUILD_SCRIPT: yarn && yarn build
107+
BUILD_DIR: docs/.vuepress/dist
108+
CNAME: https://www.xxx.com
109+
```
110+
111+
详细使用方法,可以看[jenkey2011/vuepress-deploy](https://github.com/jenkey2011/vuepress-deploy/)
112+
84113
### GitHub Pages and Travis CI
85114
86115
1. 在 `docs/.vuepress/config.js` 中设置正确的 `base`。

0 commit comments

Comments
 (0)