Node.js 使用CircleCI部署到Firebase主机
我试图弄清楚如何使用CircleCI部署到Firebase主机。据我所知,无法使用SSH密钥设置部署,因此我试图找到一种在部署期间登录Firebase并推送代码的方法。到目前为止,我在我的圈子里尝试了以下内容。yml:Node.js 使用CircleCI部署到Firebase主机,node.js,continuous-integration,firebase,circleci,Node.js,Continuous Integration,Firebase,Circleci,我试图弄清楚如何使用CircleCI部署到Firebase主机。据我所知,无法使用SSH密钥设置部署,因此我试图找到一种在部署期间登录Firebase并推送代码的方法。到目前为止,我在我的圈子里尝试了以下内容。yml: // circle.yml deployment: production: branch: circle-deploy commands: - npm install -g firebase-tools - firebase login
// circle.yml
deployment:
production:
branch: circle-deploy
commands:
- npm install -g firebase-tools
- firebase login | echo -e "${FIREBASE_EMAIL}\n${FIREBASE_PASSWORD}"
- firebase deploy
然而,我不断得到以下错误,我不知道如何补救它
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: write EPIPE
at errnoException (net.js:904:11)
at Object.afterWrite (net.js:720:19)
以下是我们部署到CircleCi所遵循的流程
deployment:
production:
branch: your_branch
commands:
- npm install -g firebase-tools
- firebase login --email $FIREBASE_USERNAME --password $FIREBASE_PASSWORD
- firebase deploy
general:
branches:
only:
- master
test:
override:
- echo "test"
deployment:
production:
branch: master
commands:
- npm install -g firebase-tools
- firebase deploy --token=$FIREBASE_TOKEN --non-interactive
看起来不错。我只是不得不这么做,还有一个更简单的方法
firebase login:ci
$FIREBASE\u token
deployment:
production:
branch: master
commands:
- firebase deploy --token=$FIREBASE_TOKEN --non-interactive
对于其他偶然发现这个问题的人,我必须采取以下步骤让CircleCI(可能还有其他CI)与Firebase主机一起工作
firebase登录:CI
FIREBASE\u令牌
)firebase部署--token=$firebase\u token--非交互式
Firebase最近添加了
登录:ci
,以防止人们将个人部署令牌用于ci服务。上述其他答案的一个小补充
为了避免在每次构建时在circle ci中全局安装firebase工具:
修改package.json文件,将firebase工具作为开发人员依赖项包括在内,如下所示:
npm install --save-dev firebase-tools
然后在circle.yml文件中:
deployment:
production:
branch: master
commands:
- ./node_modules/.bin/firebase deploy --token=$FIREBASE_TOKEN --non-interactive
这是我的初始设置,仅部署主测试,跳过测试
deployment:
production:
branch: your_branch
commands:
- npm install -g firebase-tools
- firebase login --email $FIREBASE_USERNAME --password $FIREBASE_PASSWORD
- firebase deploy
general:
branches:
only:
- master
test:
override:
- echo "test"
deployment:
production:
branch: master
commands:
- npm install -g firebase-tools
- firebase deploy --token=$FIREBASE_TOKEN --non-interactive
不知道登录:ci是件事。谢谢你指出这一点!