GitHub - Firebase 部署工作目录

发布于 2025-01-17 22:37:10 字数 1436 浏览 0 评论 0原文

如何为firebasegithub workflows指定文件夹名称。基本上我有一个.github文件夹其中.yml存储文件,但我也有frontend文件夹,我在其中存储了我的react.js src文件和所需的其他一切。

现在,当我推动更改时,我会得到此错误:

npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-03-29T10_09_41_940Z-debug-0.log

这是我的.yml文件:

name: Deploy to Firebase Hosting on merge
"on":
  push:
    branches:
      - main
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_REACTTASK_20C61 }}"
          channelId: live
          projectId: reacttask-20c61
          workingdirectory: ./frontend

如何使我的frontend文件夹是一个工作目录,现在看来它似乎不是

“

How to specify folder name for the Firebase and GitHub workflows. Basically I have a .github folder where .yml files are stored but I also have frontend folder where I store my React.js src files and everything else that is needed.

Now when I push the changes I get this error:

npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-03-29T10_09_41_940Z-debug-0.log

This is my .yml file:

name: Deploy to Firebase Hosting on merge
"on":
  push:
    branches:
      - main
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_REACTTASK_20C61 }}"
          channelId: live
          projectId: reacttask-20c61
          workingdirectory: ./frontend

How to make it that my frontend folder is a working directory, beacuse it now seems it is not

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

始终不够 2025-01-24 22:37:10

使用entrypoint选项

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_REACTTASK_20C61 }}"
          channelId: live
          projectId: reacttask-20c61
          entryPoint: ./frontend

有关更多详细信息,请参见 /a>

Use the entryPoint option

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_REACTTASK_20C61 }}"
          channelId: live
          projectId: reacttask-20c61
          entryPoint: ./frontend

for more details see the docs

榕城若虚 2025-01-24 22:37:10

非常古老的问题,但这是我的解决方案,以防其他人最终来到这里。

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build FE
        working-directory: ./frontend
        run: npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}
          firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_DATAEDU_WEB }}
          channelId: live
          projectId: dataedu-web
          entryPoint: ./frontend

在您的情况下,您需要working-everectory:./frontend才能构建。您还需要输入点:./frontend才能部署到firebase。

Pretty old question but here is my solution in case anyone else ended up here.

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build FE
        working-directory: ./frontend
        run: npm ci && npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}
          firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_DATAEDU_WEB }}
          channelId: live
          projectId: dataedu-web
          entryPoint: ./frontend

In your case, you needed working-directory: ./frontend to build. You also need entryPoint: ./frontend to deploy to Firebase.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文