如何在构建服务器上使用 'firebase login:ci'
How can I use 'firebase login:ci' on a build server
我是 运行 使用 Github Workflows and I want to be able to build my project and then immediately deploy it to my firebase project. Using firebase deploy. But if I want to use the firebase-tools I have to login on the build server. But there isn't a way to get authenticated via email and password etc. Is there anyway to enable me to get what I want to accomplish done? firebase-tools 构建的 nodejs 在我的构建脚本中是 "react-scripts build && firebase deploy"
这是我的工作流程文件,nodejs.yml:
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm i -g firebase-tools
firebase login
npm ci
npm run build --if-present
npm test
env:
CI: true
您不必在 CI 系统上使用 firebase login
。您所要做的就是按照 instructions in the documentation 与任何 CI 系统集成。
Use the CLI with CI systems
The Firebase CLI requires a browser to complete authentication, but
the CLI is fully compatible with CI and other headless environments.
On a machine with a browser, install the Firebase CLI.
Start the signin process by running the following command:
firebase login:ci
Visit the URL provided, then sign in using a Google account.
Print a new refresh token. The current CLI session will not be affected.
Store the output token in a secure but accessible way in your CI system.
Use this token when running firebase commands. You can use either of the following two options:
Store the token as the environment variable FIREBASE_TOKEN. Your system will automatically use the token.
Run all firebase commands with the --token flag in your CI system. The order of precedence for token loading is flag,
environment variable, desired Firebase project.
我是 运行 使用 Github Workflows and I want to be able to build my project and then immediately deploy it to my firebase project. Using firebase deploy. But if I want to use the firebase-tools I have to login on the build server. But there isn't a way to get authenticated via email and password etc. Is there anyway to enable me to get what I want to accomplish done? firebase-tools 构建的 nodejs 在我的构建脚本中是 "react-scripts build && firebase deploy"
这是我的工作流程文件,nodejs.yml:
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm i -g firebase-tools
firebase login
npm ci
npm run build --if-present
npm test
env:
CI: true
您不必在 CI 系统上使用 firebase login
。您所要做的就是按照 instructions in the documentation 与任何 CI 系统集成。
Use the CLI with CI systems
The Firebase CLI requires a browser to complete authentication, but the CLI is fully compatible with CI and other headless environments.
On a machine with a browser, install the Firebase CLI.
Start the signin process by running the following command:
firebase login:ci
Visit the URL provided, then sign in using a Google account.
Print a new refresh token. The current CLI session will not be affected.
Store the output token in a secure but accessible way in your CI system.
Use this token when running firebase commands. You can use either of the following two options:
Store the token as the environment variable FIREBASE_TOKEN. Your system will automatically use the token.
Run all firebase commands with the --token flag in your CI system. The order of precedence for token loading is flag, environment variable, desired Firebase project.