首页 文章

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

提问于
浏览
1

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

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

my .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

那可能吗?

1 回答

  • 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

相关问题