【问题标题】:Firebase Deployment using Github Action使用 Github Action 部署 Firebase
【发布时间】:2020-04-18 04:47:47
【问题描述】:

我正在尝试使用 Github 的操作将我的代码部署到 firebase。

我收到此错误

    success Installed "firebase-tools@7.11.0" with binaries:
      - firebase
Done in 12.99s.
/home/runner/work/_temp/30a2b6cb-a097-4d73-ac92-5379d0cc6ccf.sh: line 2: firebase: command not found

我的部署代码如下

deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@v1
        with:
          name: dist
      - name: yarn add firebase-tools
        run: |
          yarn global add firebase-tools
          firebase deploy ${{ secrets.firebase_token }} --only hosting:**** --non-interactive
        env:
          PROJECT_ID: ****

如何在全球范围内添加 firebase-tools?

我试过https://github.com/marketplace/actions/github-action-for-firebase

但出现错误

setting firebase project to ***
Now using project ***

=== Deploying to '***'...

i  deploying hosting

✔  Deploy complete!

Project Console: *******************

Error: An unexpected error has occurred.
##[error]Docker run failed with exit code 2

这里是这个的代码。

deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@v1
        with:
          name: dist
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting:****
        env:
          FIREBASE_TOKEN: ${{ secrets.firebase_token }}
          PROJECT_ID: ****

【问题讨论】:

标签: firebase github firebase-cli github-actions


【解决方案1】:
Docker run failed with exit code 2

这是在w9jds/firebase-action issue 17 中报告的

对我来说,当我删除“--only hosting:prod”时它会起作用。
可能这取决于计划。

您不能保留--only hosting:prod,除非您在firebase.json 文件中设置了多域托管站点,并且您可以部署的站点之一称为prod

【讨论】:

  • 在我的主机中,有两个站点。我想部署其中之一。这是我的 firebase.json { "hosting": { "public": "public/site_name", "ignore": [ "firebase.json", "/.*", "*/node_modules/ " ], "rewrites": [ { "source": "*", "destination": "/index.html" } ] } } 这里可能有问题
  • @AwaisNawaz hosting:******* 需要匹配其中一个站点名称。
  • 我使用w9jds/firebase-action,我试图了解究竟是什么部署到了firebase。它是仅build 目录还是整个代表?我在 firebase 文档和操作代码中都找不到答案。
  • @John你是说github.com/w9jds/firebase-action吗?如此处所示,它可以部署您上传的内容:github.com/w9jds/firebase-action/issues/20。它部署工件构建并上传。
猜你喜欢
  • 2021-02-13
  • 2020-10-05
  • 2020-01-02
  • 2017-08-17
  • 2023-02-14
  • 2020-10-11
  • 2022-07-07
  • 2020-09-25
  • 2021-10-08
相关资源
最近更新 更多