Skip to content

Commit d097972

Browse files
riptlhaoqunjiang
authored andcommitted
deployment.md: Add instructions for Travis CI (#4103)
* deployment.md: Add instructions for Travis CI * deployment.md: Same section for GitHub Pages (cherry picked from commit 9c8c5ba)
1 parent 7e0c697 commit d097972

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

docs/guide/deployment.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser
3535

3636
### GitHub Pages
3737

38+
#### Pushing updates manually
39+
3840
1. Set correct `publicPath` in `vue.config.js`.
3941

4042
If you are deploying to `https://<USERNAME>.github.io/`, you can omit `publicPath` as it defaults to `"/"`.
@@ -79,9 +81,39 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser
7981
cd -
8082
```
8183

82-
::: tip
83-
You can also run the above script in your CI setup to enable automatic deployment on each push.
84-
:::
84+
#### Using Travis CI for automatic updates
85+
86+
1. Set correct `publicPath` in `vue.config.js` as explained above.
87+
88+
2. Install the Travis CLI client: `gem install travis && travis --login`
89+
90+
3. Generate a GitHub [access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
91+
with repo permissions.
92+
93+
4. Grant the Travis job access to your repository: `travis set GITHUB_TOKEN=xxx`
94+
(`xxx` is the personal access token from step 3.)
95+
96+
5. Create a `.travis.yml` file in the root of your project.
97+
98+
```yaml
99+
language: node_js
100+
node_js:
101+
- "node"
102+
103+
cache: npm
104+
105+
script: npm run build
106+
107+
deploy:
108+
provider: pages
109+
skip_cleanup: true
110+
github_token: $GITHUB_TOKEN
111+
local_dir: dist
112+
on:
113+
branch: master
114+
```
115+
116+
6. Push the `.travis.yml` file to your repository to trigger the first build.
85117

86118
### GitLab Pages
87119

@@ -370,7 +402,6 @@ Verify your project is successfully published by Surge by visiting `myawesomepro
370402
cd -
371403
```
372404
373-
374405
### Docker (Nginx)
375406
376407
Deploy your application using nginx inside of a docker container.

0 commit comments

Comments
 (0)