小编Har*_*tte的帖子

如何通过 github actions 部署 firebase 函数?

在我的项目中,其文件夹结构如下所示:

dev-internal-web
-.firebase
-.github
-e2e
-functions
-node_modules
-src
(misc files)
Run Code Online (Sandbox Code Playgroud)

我有一个函数文件夹,其中包含 firebase 函数。我希望通过我的操作脚本自动部署它,如下所示:

name: CI

on:
  push:
    branches:
    - master

jobs:
  hosting-deploy:
    name: Deploy Hosting
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master
    - uses: actions/setup-node@master
      with:
        node-version: '10.x'
    - run: npm install
    - run: npm run build
    - uses: w9jds/firebase-action@master
      with:
        args: deploy --only hosting --project=tombstone-roleplay
      env:
        FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

  functions-deploy:
      name: Deploy Functions
      runs-on: ubuntu-latest

      steps:
      - uses: actions/checkout@master
      - uses: chrissank/deploy-firebase-functions@1.0.0
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          TARGET: default …
Run Code Online (Sandbox Code Playgroud)

npm firebase google-cloud-functions firebase-cli github-actions

5
推荐指数
1
解决办法
3007
查看次数