Skip to content

Commit 45965a6

Browse files
committed
docs: add a method to deploy vuepress site with github actions
1 parent 606ae4a commit 45965a6

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
62+
2. Create 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:`vueoress-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 see [jenkey2011/vuepress-deploy](https://github.com/jenkey2011/vuepress-deploy/)
87+
5988
### GitHub Pages and Travis CI
6089
6190
1. Set 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
@@ -56,6 +56,35 @@ cd -
5656
你可以在你的持续集成的设置中,设置在每次 push 代码时自动运行上述脚本。
5757
:::
5858

59+
### GitHub Pages and Github Actions
60+
61+
1. 创建 `Github access token`
62+
2. 在你github仓库下,创建一个 `secrets` ,填入刚创建的 `token`
63+
3. 在项目根目录下的`.github/workflows`目录(没有的话,请手动创建一个)下创建一个 `.yml` 或者 `.yaml` 文件,如:`vueoress-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+
详细使用方法,可以看[jenkey2011/vuepress-deploy](https://github.com/jenkey2011/vuepress-deploy/)
87+
5988
### GitHub Pages and Travis CI
6089
6190
1. 在 `docs/.vuepress/config.js` 中设置正确的 `base`。

0 commit comments

Comments
 (0)