Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Angular App to Firebase Hosting Github Actions

I'm trying to use Github actions to deploy my Angular app to Firebase hosting. I'm using this action in order to accomplish this. My release.yml file looks like the following:

name: Release
on:
  push:
    branches:
      - master

jobs:
  firebase-deploy:
    runs-on: ubuntu-latest

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

However when I commit this onto the master branch, I get the following error:

Error: Must supply either "site" or "target" in each "hosting" config.

I have no clue what this error means, so any help would be great. Thanks!


Edit: My firebase.json looks like the following:

{
  "hosting": [
    {
      "public": "MyName",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "projectName",
      "public": "dist/projectName",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}
like image 394
Gabe Avatar asked Oct 31 '25 05:10

Gabe


1 Answers

I seemed to have fixed the issue by just simply removing the second section of hosting turning this:

{
  "hosting": [
    {
      "public": "MyName",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "projectName",
      "public": "dist/projectName",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}

into the following:

{
  "hosting": [
    {
      "target": "projectName",
      "public": "dist/projectName",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}

I'm not sure if there is any side effects to do this, but it seems to be working fine.

like image 112
Gabe Avatar answered Nov 02 '25 18:11

Gabe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!