我的 Nest.js 应用程序可以通过 CLI 毫无问题地部署到本地 Firebase。但是,我的 GitHub 操作失败并输出错误:
错误:不在 Firebase 应用目录中(无法找到 firebase.json)
我很困惑,因为
firebase.json
位于 apps/webhook-broadcaster/firebase.json 中。
这是我完整的 GitHub 操作
name: Firebase Deployment
on:
push:
branches:
- main
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: "8.15.4"
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "v20.8.0"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
- name: Install Nest CLI
run: pnpm install --global @nestjs/cli
- name: Build
run: |
cd apps/webhook-broadcaster
pnpm install
pnpm run build
- name: Archive Production Artifact
uses: actions/upload-artifact@v2
with:
name: build
path: apps/webhook-broadcaster/dist
deploy:
name: Deploy to Firebase Hosting
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: build
path: apps/webhook-broadcaster/dist
- name: Deploy to Firebase Hosting
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WEBHOOK_BROADCASTER }}
这是我编写的 GitHub 操作,也是我部署的第一个 Firebase 应用程序。我希望在这个问题上得到一些帮助或指导。谢谢!
试试这个:
- name: Deploy to Firebase Hosting
uses: w9jds/firebase-action@master
working-directory: ./apps/webhook-broadcaster
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WEBHOOK_BROADCASTER }}