我用travis-ci
这个更好,在每次提交中都会自动构建和部署 github 页面,它并没有那么复杂,只需在构建中添加travis.yml
和更新 baseurlangular.json
像这样:
"baseHref": "https://username.github.io/repo-name/"
作为我的例子:
"baseHref": "https://malbarmawi.github.io/angular-lessons/"
travis.yml
language: node_js
node_js:
- "9"
dist: trusty
sudo: false
branches:
only:
- master
cache:
directories:
- node_modules
install:
- npm i @angular/cli@6.2.4 -g
- npm i
script:
- ng build --prod
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: dist/
on:
branch: master
最后得到github 令牌,你可以查看我的项目
这篇文章可以帮助我使用 Travis-CI 将您的 Angular 应用程序部署到 GitHub 页面