我正在尝试使用github动作自动将React应用部署到Firebase,但是出现以下错误:
Error: Autorization failed. This account is missing the following required permissions on project ***
firebase.projects.get
firebasehosting.sites.update
我有多个站点,当我尝试使用firebase deploy --only hosting:MY_SITE_NAME
进行手动部署时,它可以正常工作。我的工作流程中有两项工作。构建作业通过,但部署作业失败。这是我的工作流程文件:
name: Build and Deploy to Firebase
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install Dependencies
run: yarn install
- name: Build
run: yarn build
- name: Archive Production Artifact
uses: actions/upload-artifact@master
with:
name: build
path: build
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: build
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:MY_SITE_NAME
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
有人知道错在哪里吗?
答案 0 :(得分:0)
如果您想在CI / CD环境(例如GitHub Action)中使用Firebase CLI,则必须提供一种让CLI知道应该使用的帐户凭据的方法。在本地运行时,它可以从与firebase login
的交互中获取凭据。但是当您在其他地方运行时,没有UI提示您。
您将必须follow the instructions in the documentation on integrating with CI/CD system,并为用于授权部署的帐户提供令牌。