firebase - 如何使用 github 操作和 w9jds/firebase-action 部署到不同的 firebase 环境

标签 firebase github firebase-hosting github-actions firebase-cli

我正在尝试使用 Github Actions 为我的 angular 项目设置 CI 到 firebase,但我有一个临时环境和生产环境,我想根据我推送到的分支部署到每个环境。

我知道我可以为我的 master 创建两个不同的工作流脚本和 dev分支,但我不知道如何使用 w9jds/firebase-action 部署到不同的 Firebase 环境.

当我使用脚本时:

on:
  push:
    branches:
      - dev

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build-prod
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: dist
          path: dist
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@master
        with:
          name: dist
          path: dist
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting:staging
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

我收到以下错误:
Error: No project active, but project aliases are available.

Run firebase use <alias> with one of these options:

  production (#####)
  staging (#####)

我究竟做错了什么?

最佳答案

我认为你需要:

with:
  args: deploy --only hosting --project staging
hosting:*部署目标适用于同一项目中的多个站点,要指定您应该使用的项目 --project-P .

关于firebase - 如何使用 github 操作和 w9jds/firebase-action 部署到不同的 firebase 环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62397129/

相关文章:

javascript - 如何在 node.js 中关闭 firebase 连接

node.js - HTTP事件云函数: request body value is undefined

node.js - 如何在 firebase 上使用已部署的应用程序和已部署的函数存储数据

java - 如何以编程方式创建 GitHub 存储库?

android - Android 上的 Circle CI 集成与托管在不同 github 存储库上的外部模块

node.js - 在 Firebase 托管上安装 NPM 依赖项

javascript - 如何执行从 Firebase 托管到 AWS Lambda 函数的跨源请求

android - 使用多个键搜索和更新 firebase

google-analytics-api - 具有服务器端授权的 Google Analytics Embed API - Firebase 托管

git - 仅将一个文件从本地存储库推送到 GitHub