travis ci无法在Firebase托管上部署

Man*_*ani 0 travis-ci firebase firebase-hosting firebase-cli

我正在尝试将travis ci集成到我的firebase应用程序上以自动部署,但是失败并显示401错误。这是我的.travis.yml

language: node_js
node_js:
 - '8'
deploy:
  provider: firebase
  token:
   secure: "BnzKtrzBaI/uLHoezYpBVqQ/VwhIyil...n0jAuBNrTI="
  message: build $TRAVIS_BUILD_NUMBER $TRAVIS_BRANCH/$COMMIT_HASH
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
Run Code Online (Sandbox Code Playgroud)

我不确定是怎么回事。

ske*_*hat 6

I haven't used the provider function in Travis CI before, but another option of deploying to Firebase hosting is to install firebase-tools and use the CLI.

language: node_js
node_js: 8

before_script:
  - npm install firebase-tools -g

script:
  - firebase deploy --only hosting --token "BnzK...rTI="
Run Code Online (Sandbox Code Playgroud)

-- Edit: More information on Cloud Functions and Branch Filters. --

如果还要部署Cloud Functions,则需要先安装node_moduleson travis,然后才能进行部署。

language: node_js
node_js: 8

before_script:
  - npm install firebase-tools -g
  - cd functions && npm install

script:
  - firebase deploy --only hosting,functions --token "BnzK...rTI="
Run Code Online (Sandbox Code Playgroud)

如果只想在对master分支进行更改时部署,则可以在此过滤器中添加。

language: node_js
node_js: 8

before_script:
  - npm install firebase-tools -g
  - cd functions && npm install

script:
  - firebase deploy --only hosting,functions --token "BnzK...rTI="

branches:
  only:
    - master
Run Code Online (Sandbox Code Playgroud)