首页 > 解决方案 > 未找到具有提供的路径的文件:build. 不会上传任何工件。- 将 React App 部署到 Firebase 的 Github Action

问题描述

我正在关注教程,了解如何使用 github 操作为 react 应用程序设置 CI/CD。我想要构建我的 react 应用程序并将其部署到我的 firebase 项目以进行托管的操作。我很确定我已按照指示进行操作,但是当我通过推送触发我的操作时,我收到此错误:

> Run actions/download-artifact@v2   
> with:
>     name: build
>     path: build Starting download for build Error: Unable to find any artifacts for the associated workflow
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Firebase CI

on: push 

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/f

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - name: Archive Build
      uses: actions/upload-artifact@v2
      with:
        name: build
        path: build
        
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Download Build
        uses: actions/download-artifact@v2
        with:
          name: build
          path: build
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

我可以从控制台手动安装、构建和部署。我认为这个错误可能与我的构建目录的位置有关,但它在标准位置。关于这可能是什么的任何想法?

链接到这里的完整回购

附加截图:

行动结果

标签: reactjsfirebasegithub-actions

解决方案


似乎/build从我的 .gitignore 中删除解决了这个问题。我不知道为什么 %100,因为我见过的类似操作的例子都没有包括它们的构建文件夹。


推荐阅读