如何在circleci中构建firebase项目,包括firestore和存储规则

如何在circleci中构建firebase项目,包括firestore和存储规则,firebase,google-cloud-firestore,firebase-storage,circleci,Firebase,Google Cloud Firestore,Firebase Storage,Circleci,我有一个在firebase中托管的react项目。我正在使用circleci进行构建。这一直运作良好。但是,我希望在构建中包括firebase firestore规则、索引配置和firebase storeage规则 我已将它们添加到我的firebase.json文件中,如下所示: "firestore": { "rules": "firestore.rules", "indexes": "firestore.indexes.json" }, "storage": {

我有一个在firebase中托管的react项目。我正在使用circleci进行构建。这一直运作良好。但是,我希望在构建中包括firebase firestore规则、索引配置和firebase storeage规则

我已将它们添加到我的firebase.json文件中,如下所示:

 "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "storage": {
    "rules": "storage.rules"
  }
如果我从命令行执行firebase部署,我配置的规则和索引可以正常工作

当我尝试在circleci中构建时,我的问题就出现了。我进入部署阶段,然后出现以下错误:

i  deploying firestore, hosting

Error: Error reading rules file firestore.rules
Exited with code 1
这是config.yml的相关部分:

deploy_uat:
    docker:
      - image: google/cloud-sdk
    steps:
      - run: echo $(printenv)

      - type: shell
        name: "Provisioning infrastructure"
        command: |
          curl -sL https://deb.nodesource.com/setup_8.x | bash -
          apt-get -qq install -y build-essential nodejs
          echo "node version -> $(node --version)"
          echo "npm version -> $(npm --version)"

          # Firebase tools include native code and need npm 5.x to install into a special dir since it won't have permission to access '/usr/lib/node_modules/'
          mkdir ~/.npm-global
          npm config set prefix '~/.npm-global'
          export PATH=~/.npm-global/bin:$PATH

          npm install -g firebase-tools

      - type: shell
        name: "Downloading & configuring archive prior to deployment"
        command: |
          echo ${GCP_SERVICE_ACCOUNT_AMCE_API_ADMIN_CIRCLECI} | base64 --decode > key.json
          gcloud auth activate-service-account --key-file key.json
          gcloud config set compute/zone us-central1
          gcloud config set project AMCE-45

          mkdir tmp
          cd tmp
          gsutil cp gs://AMCE-45-AMCE-admin-archive-web/${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tgz .
          tar xfz ${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tgz
          ls -al

      - type: shell
        name: "Deploying"
        command: |
          export PATH=~/.npm-global/bin:$PATH

          ls -al build
          echo "Using env -> $(cat build/env.js)"

          firebase list --token "${FIREBASE_AUTH_TOKEN_AMCE_WEB_CUSTOMER_UAT}"
          firebase deploy -P uat --token "${FIREBASE_AUTH_TOKEN_AMCE_WEB_CUSTOMER_UAT}"

是否需要添加其他依赖项?我一直在尝试添加各种firebase依赖项,但只是产生了错误。

经过一夜的睡眠,解决方案显而易见

我没有将firestore.rules、storage.rules和firestore.indexes.json添加到config.yml文件中。一旦我加上它们,它就建得很好

      ls -al
      tar -zcvf ${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tgz .firebaserc firebase.json firestore.rules storage.rules firestore.indexes.json build