如何同时从travis部署多个firebase hostng项目(没有暂存或仅生产其他网站)

Geo*_* C. 1 travis-ci firebase firebase-hosting firebase-tools

我想在可能的同时从Travis多个firebase托管项目部署??,如果是的话我会很高兴:)

因为我现在有10个项目,所有都是相同的代码,我认为我可以更容易地同时从1 git repo部署到我的所有网站,现在我在那个时间做了1个,需要4-5个小时要做到这一点

我的.travis.yml

language: node_js
node_js:
  - "7"

branches:
  only:
    - master

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

script:
  - ng build --prod

after_success:

  - firebase deploy --token $FIREBASE_TOKEN_1 <-- this is for https://project1.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_2 <-- this is for https://project2.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_3 <-- this is for https://project3.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_4 <-- this is for https://project4.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_5 <-- this is for https://project5.firebaseapp.com
  - firebase deploy --token $FIREBASE_TOKEN_6 <-- this is for https://project6.firebaseapp.com

notifications:
  email:
    on_failure: change
    on_success: change
Run Code Online (Sandbox Code Playgroud)

那可能吗?

Den*_*und 5

是的,一点没错.只需在.firebaserc文件中声明项目即可

{ "projects": { "project1": "firebase-project-id-1", "project1": "firebase-project-id-1", ... "project10": "firebase-project-id-10" } }

然后你只需在每个之间切换活动项目 firebase deploy

- firebase use project1 --token $FIREBASE_DEPLOY_KEY1 - firebase deploy --non-interactive --token $FIREBASE_DEPLOY_KEY1 ... - firebase use project10 --token $FIREBASE_DEPLOY_KEY10 - firebase deploy --non-interactive --token $FIREBASE_DEPLOY_KEY10

  • 别客气.随意将答案标记为已接受 (2认同)