Travis ci在firebase上部署了angular 2 app

时间:2017-07-04 19:10:14

标签: angular firebase travis-ci

我尝试使用Travis ci在firebase上部署我的angular 2应用程序,但似乎找不到ng build --prod生成的dist文件夹。

这是我的.travis.yml

# tavis.yml

language: node_js
node_js:
  - "7"

branches:
  only:
  - master
  - develop

before_script:
  - npm install -g --silent @angular/cli
  - npm install -g --silent firebase-tools
  - npm install

script:
  - if [ "$TRAVIS_BRANCH" == "master" ]; then ng build --prod; fi
  - if [ "$TRAVIS_BRANCH" != "master" ]; then ng build --dev; fi

deploy:
  - provider: firebase
    token:
      secure: token
    project: "wefaves-dev"
    on:
      branch: develop
  - provider: firebase
    token:
      secure: token
    project: "wefaves-prod"
    on:
      branch: master

这里我的travis记录:

49.88s$ ng build --prod
Your global Angular CLI version (1.2.0) is greater than your local
version (1.0.0). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMismatch=false".
 10% building modules 3/3 modules 0 active 10% building modules 4/5 modules 1 active .../build/wefaves/client/src/styles.sass 10% building modules 4/6 modules 2 active ...ode_modules/style-loader/addStyles.js 10% building modules 5/6 modules 1 active .../build/wefaves/client/src/styles.sass 10% building modules 7/7 modules 0 active 11% building modules 10/13 modules 3 active ...$$_gendir/app/app.module.ngfactory.ts 11% building modules 15/18 modules 3  11% building modules 16/19 modules 3 active ...ount/bookmarks/bookmarks.component.ts 12% building modules 21/24 modules 3  12% building modules 23/26 modules 3 active ...nt/login/login.component.ngfactory.ts 12% building modules 24/27 modules 3 active ...n/registration.component.ngfactory.ts 13% building modules 25/28 modules 3 active ...arks/bookmarks.component.ngfactory.ts 13% building modules 27/30 modules 3 active ...rofile/profile.component.ngfactory.ts 13% building modules 32/35 modules 3 active ...src/app/_services/book 14% building modules 35/42 modules 7 active ...t/nod 14% building modules 35/44 modules 9 active ...ent/node_modules/zone.js/dist/zone.js 14% building modules 36/44 modules 8 active ...ent/node_modules/zone.js/dist/zone.js 14% building modules 41/49 modules 8  15% buil 15% building modules 49/60 modules 11 active ...irectives/menu.component.ngfactory.ts 16% building modules 52/63 modules 11 active ...node_modules/rxjs/add/operator/map.js 17% building modules 59/66 modul 17% building modules 59/70 modules 11 active ...de_modules/rxjs/operator/concatMap.js 17% building modul 17% building modules 60/88 modules 28 active .. 17% building modules 60/98 modules 38 active ...s/module 17% building modules 61/1 17% building modules 63/114 modules 51 active ...ode_modules 18% building modules 68/1 19% building modules 78/118 modules 40 active ...de_modules/ 20% building modules 87/1 21% building modules 97/118 modules 21 active ...de_modules/ 22% building modules 103/118 modules 15 active ...de_modules/rxjs/operator/ 23% building modules 112/119 module 23% building modules 116/124 modules 8 active .../node_modules 23% bui 23% building modules 116/143 modules 27 active ...de_modules/core-js/modules 24% building modules 118/150  25% building modules 125/153 modules 2 26% building modules 134/153 modules 19 active ...s/observable/Conn  28% building modules 151/155 modules 4 active ...node_modules/rxjs/util/isArrayLike.j 28% buil 28% building modules 151/174 modules 23 active ...odules/co 28% building modules 151/183 modules 32 active 28% building modules  30% building modules 167/186 modules 19 active ...de_modules/core-js/modules/_for-of 31% building modu 32% building 32% building modules 186/ 32% building modules 32% building modules 186/205 modules 19 active ...les/core-js/modules/_is-array-iter. 33% building mod 34% building modules 203/207 modules 4 active ...s/modules/ 34% building modules 207/2 35% building modules 214/215 modules 1 active ..._modules/c 36% building m 86% hashing 92% chunk asset optimizationHash: 0be334be0a95b1f1877f
Time: 42349ms
chunk    {0} polyfills.7306ee46c4105d171c4b.bundle.js (polyfills) 160 kB {4} [initial] [rendered]
chunk    {1} main.a03917b04d3eb0d5235f.bundle.js (main) 138 kB {3} [initial] [rendered]
chunk    {2} styles.f63f827419d4933ffa35.bundle.css (styles) 69 bytes {4} [initial] [rendered]
chunk    {3} vendor.03b32157ee3b186790b7.bundle.js (vendor) 1.43 MB [initial] [rendered]
chunk    {4} inline.8f67fd0e9425eb8b2ee4.bundle.js (inline) 0 bytes [entry] [rendered]

(我的应用程序正确构建)

Deploying application
=== Deploying to 'wefaves-dev'...
i  deploying hosting
Error: Specified public directory does not exist, can't deploy hosting

和我的firebase.json

{
  "projects": {
    "dev": "wefaves-dev",
    "prod": "wefaves-prod"
  }
}

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

请添加以下内容。 skip_cleanup:true

默认情况下,travis会隐藏所有不属于您的存储库的更改。

请参阅下文。

https://docs.travis-ci.com/user/deployment/#Uploading-Files