Giter Site home page Giter Site logo

firebase-action's Introduction

GitHub Actions for Firebase

This Action for firebase-tools enables arbitrary actions with the firebase command-line client.

If you want a more flexible implementation, an early version of a rewrite is available here: setup-firebase that allows you to choose node and java version and run more than one command.

Inputs

  • args - Required. This is the arguments you want to use for the firebase cli

Outputs

* response - The full response from the firebase command current run (Will most likely require a grep to get what you want, like URLS)

Response has been removed for now as it caused loads of issues in the bash script

Environment variables

  • GCP_SA_KEY - Required if FIREBASE_TOKEN is not set. A normal service account key (json format) or a base64 encoded service account key with the needed permissions for what you are trying to deploy/update.

    • Since the service account is using the App Engine default service account in the deploy process, it also needs the Service Account User role.
    • If deploying functions, you would also need the Cloud Functions Developer role.
      • If the deploy has scheduled functions, include the Cloud Scheduler Admin role.
      • If the deploy requires access to secrets, include the Secret Manager Viewer role.
      • If updating Firestore Rules, include the Firebase Rules Admin role.
      • If the project is using Blocking functions (beforeCreate or beforeSignin) , include the Firebase Functions Admin role.
    • If updating Firestore Indexes, include the Cloud Datastore Index Admin role.
    • If deplying Hosting files, include the Firebase Hosting Admin role.
    • For more details: https://firebase.google.com/docs/hosting/github-integration
  • FIREBASE_TOKEN - Required if GCP_SA_KEY is not set. This method will soon be deprecated, use GCP_SA_KEY instead. The token to use for authentication. This token can be aquired through the firebase login:ci command.

  • GOOGLE_APPLICATION_CREDENTIALS - Required if GCP_SA_KEY or FIREBASE_TOKEN is not set. the location of a credential JSON file. For more details: https://cloud.google.com/docs/authentication/application-default-credentials#GAC

  • PROJECT_ID - Optional. To specify a specific project to use for all commands. Not required if you specify a project in your .firebaserc file. If you use this, you need to give Viewer permission roles to your service account otherwise the action will fail with authentication errors.

  • PROJECT_PATH - Optional. The path to the folder containing firebase.json if it doesn't exist at the root of your repository. e.g. ./my-app.

  • CONFIG_VALUES - Optional. The configuration values for Firebase function that would normally be set with firebase functions:config:set [value]. Example: CONFIG_VALUES: stripe.secret_key=SECRET_KEY zapier.secret_key=SECRET_KEY.

Example

To authenticate with Firebase, and deploy to Firebase Hosting:

name: Build and Deploy
on:
  push:
    branches:
      - master

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
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Alternatively:

        env:
          GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

If you have multiple hosting environments you can specify which one in the args line. e.g. args: deploy --only hosting:[environment name]

If you want to add a message to a deployment (e.g. the Git commit message) you need to take extra care and escape the quotes or the YAML breaks.

        with:
          args: deploy --message \"${{ github.event.head_commit.message }}\"

Alternate versions

Starting with version v2.1.2 each version release will point to a versioned docker image allowing for hardening our pipeline (so things don't break when I do something dump). On top of this, you can also point to a master version if you would like to test out what might not be deployed into a release yet by using something like this:

  name: Deploy to Firebase
  uses: docker://w9jds/firebase-action:master
  with:
    args: deploy --only hosting
  env:
    FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

Recommendation

If you decide to do seperate jobs for build and deployment (which is probably advisable), then make sure to clone your repo as the Firebase-cli requires the firebase repo to deploy (specifically the firebase.json)

firebase-action's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebase-action's Issues

Either FIREBASE_TOKEN or GCP_SA_KEY is required to run commands with the firebase cli

When my "Deploy to Firebase" step runs, I get the error:

Either FIREBASE_TOKEN or GCP_SA_KEY is required to run commands with the firebase cli

This is what the step looks like in my yaml file

    - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

and I have my secret correctly set as well:

image

What could be the issue?
Thanks

eslint not detected

Hello! I am having an issue with the deploy, it seems as though the linting script that normally comes with Firebase is not functioning or not being detected, during the deploy I receive the following errors.

I have updated npm, ran npm install in the functions folder, and manually reinstalled lint. Lint was also successfully automatically installed originally with firebase init.

i  deploying database, storage, firestore, functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /github/workspace/functions
> eslint .

sh: 1: eslint: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! functions@ lint: `eslint .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2020-03-13T04_57_55_951Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

Error: An action could not be found

##[error]An action could not be found at the URI 'https://api.github.com/repos/w9jds/firebase-actions/tarball/v1.5.0'

Using:

- name: Deploy function to Firebase
  uses: w9jds/[email protected]
  with:
    args: deploy --only functions
  env:
    FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Get the same with w9jds/firebase-action@master too.

Deploy target xxx not configured for project

I need to deploy each branch of my project (except master, which has its own workflow for GitHub pages) to a different firebase hosting site target. In order to do that, I just set the right target in each branch, and defined this workflow:

name: Branches Firebase Deploy
   
on:
  push:
    branches:
      - parisweb-2019
      - devfestnantes-2019

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
      - 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
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Yet, I get the following error:

=== Deploying to 'wof-show'...

i  deploying hosting

Error: Deploy target devfestnantes-2019 not configured for project wof-show. Configure with:

  firebase target:apply hosting devfestnantes-2019 <resources...>
##[error]Docker run failed with exit code 1

even if the target is indeed configured in:

https://github.com/noelmace/slides-wof-conf/blob/b5a54c26d55bac92237a5ef24d1e9b2fed8ed11f/.firebaserc

and, of course, exist on Firebase.

IT WORKS
¯\_(ツ)_/¯
on my machine

Here is my project: https://github.com/noelmace/slides-wof-conf

Cant deploy to other enviroment than default

/usr/bin/docker run --name aac2aa809a24076cc543209e911edae508de18_f604d4 --label aac2aa --workdir /github/workspace --rm -e FIREBASE_TOKEN -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/landing/landing":"/github/workspace" aac2aa:809a24076cc543209e911edae508de18 deploy --only hosting:development

Error: No project active, but project aliases are available.

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

  default (tingo-landing)
  development (tingo-landing-dev)

Deploy failed

Since this morning I've been different errors when I deploy, sometimes HTTP Error: 500, Internal error encountered and sometimes Failed to get status of functions deployments.

The code :

name: CI-Develop
on: [pull_request]

jobs:

  main:
    name: Lint, build and deploy
    runs-on: ubuntu-latest
    steps:

      - name: Node.js ⇒ Setup
        uses: actions/setup-node@master
        with:
          node-version: '10.x'
      - name: Git ⇒ Checkout project
        uses: actions/checkout@v1

      - name: Yarn ⇒ Get dependencies for back
        run: cd functions && yarn install
      - name: Lint ⇒ Lint back
        run: cd functions && npm run lint
      - name: Typescript ⇒ Build back
        run: cd functions && npm run build

      - name: Yarn ⇒ Get dependencies for front
        run: cd app && yarn install
      - name: Lint ⇒ Lint front
        run: cd app && npm run lint
      - name: React ⇒ Build front
        run: cd app && npm run build

      - name: Firebase ⇒ deploy
        uses: w9jds/firebase-action@master
        with:
          args: use staging && firebase deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Equivalent of `firebase use <environment>`?

Thank you for creating this action.

How do I switch environments? The docs explain how to do it for hosting only (args: deploy --only hosting:[environment name]), but what if I want to run a wholesale deploy?

I'd like a equivalent to:

firebase use staging
firebase deloy

is this possible using this action and if so how?

Preprend cross-env NODE_ENV=production

As part of my package.json, my deploy script looks like this:

"deploy": "cross-env NODE_ENV=production firebase deploy --only functions,hosting"

Without the cross-env NODE_ENV=production, my deployed app doesn't work.
With just args: deploy --only functions,hosting in the workflow, I get this error during the deploy:
Image 2020-03-31 at 2 26 59 PM

I have "main": "dist/server/index.js" set in package.json, and if I download the build zip, that file does exist. Not sure what I'm doing wrong here.

Is it possible to prepend cross-env NODE_ENV=production before firebase deploy?

I should note that I also tried args: deploy --only functions,hosting:production and got the same error.

Accessing output of previous job

I'm having trouble accessing the output of a previous job using the following workflow config:

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Install Dependencies
        run: yarn install
      - name: Build
        run: yarn build
  deploy:
    runs-on: ubuntu-18.04
    needs: build
    steps:
      - name: deploy
        uses: w9jds/[email protected]
        if: success()
        with:
          args: deploy --only hosting
        env:
          PROJECT_ID: vgbc-tracker
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN_PROD }}

I thought that the build job should be putting its output in the /github/workspace directory and that should get picked up by this docker file.

Everything works great if I change my workflow to look like this:


on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Install Dependencies
        run: yarn install
      - name: Build
        run: yarn build
      - name: deploy
        uses: w9jds/[email protected]
        if: success()
        with:
          args: deploy --only hosting
        env:
          PROJECT_ID: vgbc-tracker
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN_PROD }}

Cloud Function deployment failure

Hi there,

Thanks for this very useful Github Action. We've been using it for quite some time and it has served us very well so far.

Today when we tried to deploy Cloud Functions the deployments started failing because the Node.js version clashed with the one set in our package.json. Since Cloud Functions only support Node.js v10, we have an engine entry in our package.json to restrict the Node.js version to v10. I see you've recently updated the Dockerfile for this action to use Node.js v12.18.1 which is the reason the error is occurring for us.

We've updated our workflow config to use v1.3.1 of your action instead of master which was a bit reckless on our end.

Would it be possible for you to expose a property that we can use to set the Node.js version that your action should use or even better somehow automatically detect the Node.js version that our workflow is running with?

Error: An unexpected error has occurred.

Hi,
The YML was working fine until 15/06/2020, now, the deployment is executed and I have this error:

image

I don't have many information from the github action log, I executed the command firebase deploy manually and it's working fine. This is my YML:

name: deploy

on:
  push:
    branches: [ master ]

jobs:

  deploy:

    runs-on: ubuntu-latest
    strategy:
      matrix:
       node-version: [12.x]


    steps:

    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: Install Packages
      run: npm install
    - name: Build App
      run: npm run build
    - name: Deploy to Firebase
      uses: w9jds/firebase-action@master
      with:
        args: deploy
    env:
      FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

This is my firebase.json

{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  }
}

Thanks for your help.

Problem deploying multi sites on firebase hosting

Hello thank you for this awsome tool, please i have an issue when deploying my project
the project have multiple firebase sites.
when I build project in stagging or prod mode, I have 2 folders : dist/stag and dist/prod
So when I use firebase-action in stag mode, it fails on deployment, saying that the folder dist/stag is not found. But this works well when i deploy with my OS

this is the workflow

name: Node CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x]

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: Installation des dépendances et packaging (build) du projet
      run: |
        npm i
        npm ci
    - name: Packaging (build) du projet
      run: npm run build
    - name: Archivage des Artifacts
      uses: actions/upload-artifact@master
      with:
        name: dist_stag
        path: dist/stag
      env:
        CI: true
  deploy:
    name: Deploiement sur firebase
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Téléchargement des Artifacts
        uses: actions/download-artifact@master
        with:
          name: dist_stag
      - name: Deploiement sur firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting:stag
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: semges-b24ca

This is the github output:

image

Thanks in advance for your help.

Action fails due to firebase CLI asking for user input

Was working great, then all the sudden on 06-05-2020 got this message and our deploys have been failing:

? Would you like to delete these indexes? Selecting no will continue the rest of
 the deployment. (y/N) 

This is how the .yml file is configured:

- name: Point to project and deploy
        uses: w9jds/firebase-action@master
        with:
          args: deploy --except functions
        env:
          # Better to use `secrets`, which we can set in GitHub settings rather than hard-coding token here
          FIREBASE_TOKEN: ${{ secrets.GH_ACTIONS_DEPLOY_TOKEN }}
          # Akin to `firebase use project_id_here`
          PROJECT_ID: "project_id_here"
          # Need to find firebase.json since it's not in root dir
          PROJECT_PATH: ./folder_name_here

Ran the deploy script locally, I get a similar warning but doesn't ask for user input, so deploy succeeds.

I am using the latest action by the way

Maybe this is more of a scripting question, but would it be possible to ignore that user prompt and continue the rest of the script? Thank you.

eslint not found

I get the following error when I try to deploy a project that contains functions:

Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /github/workspace/functions
> eslint .

sh: 1: eslint: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! functions@ lint: `eslint .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2019-04-13T22_38_21_831Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

### FAILED GitHub Action for Firebase 22:38:32Z (1m2.779s)

I'm assuming this is because the deps for functions aren't installed.

Setting PROJECT_PATH did not work

My entire firebase project is in a subdirectory under the root.

I set PROJECT_PATH variable correctly, but I still got the error: Error: firebase use must be run from a Firebase project directory.

I noticed that in entrypoint.sh, the call to firebase use ... occurs before the call to cd $PROJECT_PATH. I think the order of the two should be switched.

I'm happy to submit PR if this is indeed the problem, or let me know if I am missing something. Thanks!

`deploy` command fails with `-m --message` argument

I noticed I'm not able to add deploy messages with my deployments.
I tested -m vs --message as well as tested if my other parameters were a problem. It works as expected when I deploy manually.

My action

      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --message "CICD Deployment" --only hosting:production,hosting:cdn --project fuse-fonts
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          CI: true

It fails without an error message:
image

Reviewing the deploys in my firebase console shows that it was not deployed, so it isn't a case of a false-negative.

You can view my deployments, and their workflow files here: https://github.com/fuse-fonts/website/actions.

Upon removing the message it deploys successfully again.

Install java

Since some commands like emulators:exec requires java.

I'm receiving

Error: firestore: Firestore Emulator has exited because java is not installed, you can install it from https://openjdk.java.net/install/

on Github Actions CI when on step...

      - name: Test
        uses: w9jds/[email protected]
        env:
          JAVA_HOME: ${{ env.JAVA_HOME }}
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          GCLOUD_PROJECT: ${{ secrets.nextGCLOUD_PROJECT }}
          PROJECT_ID: ${{ secrets.nextFIREBASE_PROJECTID }}
        with:
          args: emulators:exec --only functions,firestore \"npm run test --exit -- --forceExit --detectOpenHandles\"

consider run on other working-directory

Hi,

I'm using firebase functions partially in my project's sub directory ./firebase
So, I need to run firebase deploy --only functions in ./firebase directory.

can you add working-directory argument to this action like plain run command?

Best,

Run error

This is occurring repeatedly for me:

> [email protected] postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine
> node ./compatibility/detect.js

fs.js:114
    throw err;
    ^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/index.js'
    at Object.openSync (fs.js:443:3)
    at Object.writeFileSync (fs.js:1194:35)
    at /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:35:15
    at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:45:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

My styles are not being deployed when I use this function.

I have a project bootstrapped from create-react-app. I have setup tailwindcss with postcss-cli.
I have tested that everything works on my local machine. When I use the firebase deploy --only hosting from my local machine, everything works perfectly.
When I use the code mentioned in the github action description, no styles are deployed and the site looks broken.

Error: @google-cloud%2fpubsub - Not found

I am using "w9jds/firebase-action@master" and I just started seeing the following error when using the action:

   ---> Running in cd78b71d83ec
  npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
  npm ERR! code E404
  npm ERR! 404 Not Found - GET https://registry.npmjs.org/@google-cloud%2fpubsub - Not found
  npm ERR! 404 
  npm ERR! 404  '@google-cloud/pubsub@^1.7.0' is not in the npm registry.
  npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
  npm ERR! 404 It was specified as a dependency of 'firebase-tools'
  npm ERR! 404 
  npm ERR! 404 Note that you can also install from a
  npm ERR! 404 tarball, folder, http url, or git url.

Broke deployment

Just started getting error. Everything was going well couple of hours back.

Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.

EACCESS with `npm install -g firebase-tools`

2020-06-21T09:58:11.0318028Z Step 10/14 : RUN npm install -g firebase-tools
2020-06-21T09:58:11.0421728Z  ---> Running in 50ade17f217f
2020-06-21T09:58:12.9119224Z �[91mnpm�[0m�[91m WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
2020-06-21T09:58:26.9619471Z �[0m/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
2020-06-21T09:58:27.0361948Z 
2020-06-21T09:58:27.0362975Z > [email protected] postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/protobufjs
2020-06-21T09:58:27.0363184Z > node scripts/postinstall
2020-06-21T09:58:27.0363272Z 
2020-06-21T09:58:27.2149187Z 
2020-06-21T09:58:27.2149704Z > [email protected] postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine
2020-06-21T09:58:27.2149889Z > node ./compatibility/detect.js
2020-06-21T09:58:27.2149986Z 
2020-06-21T09:58:27.2864720Z �[91mfs.js:114
2020-06-21T09:58:27.2865857Z     throw err;
2020-06-21T09:58:27.2866847Z     ^
2020-06-21T09:58:27.2866917Z 
2020-06-21T09:58:27.2867087Z Error: EACCES: permission denied, open '/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/index.js'
2020-06-21T09:58:27.2867267Z     at Object.openSync (fs.js:443:3)
2020-06-21T09:58:27.2867416Z     at Object.writeFileSync (fs.js:1194:35)
2020-06-21T09:58:27.2867579Z     at /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:35:15
2020-06-21T09:58:27.2867782Z     at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:45:3)
2020-06-21T09:58:27.2867958Z     at Module._compile (internal/modules/cjs/loader.js:778:30)
2020-06-21T09:58:27.2868152Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2020-06-21T09:58:27.2868314Z     at Module.load (internal/modules/cjs/loader.js:653:32)
2020-06-21T09:58:27.2868465Z     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2020-06-21T09:58:27.2868618Z     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2020-06-21T09:58:27.2868773Z     at Module.require (internal/modules/cjs/loader.js:692:17)
2020-06-21T09:58:28.1712904Z �[0m�[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents):
2020-06-21T09:58:28.1714351Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-06-21T09:58:28.1714837Z �[0m�[91m
2020-06-21T09:58:28.1715436Z �[0m�[91mnpm ERR! code�[0m�[91m ELIFECYCLE
2020-06-21T09:58:28.1716647Z �[0m�[91mnpm ERR! errno 1
2020-06-21T09:58:28.1717248Z �[0m�[91mnpm ERR!�[0m�[91m [email protected] postinstall: `node ./compatibility/detect.js`
2020-06-21T09:58:28.1717626Z npm ERR! Exit status 1
2020-06-21T09:58:28.1717925Z �[0m�[91mnpm ERR!�[0m�[91m 
2020-06-21T09:58:28.1718244Z npm ERR! Failed at the [email protected] postinstall script.
2020-06-21T09:58:28.1718608Z npm ERR!�[0m�[91m This is probably not a problem with npm. There is likely additional logging output above.
2020-06-21T09:58:28.1718939Z �[0m�[91m
2020-06-21T09:58:28.1719250Z �[0m�[91mnpm ERR!�[0m�[91m A complete log of this run can be found in:
2020-06-21T09:58:28.1719598Z npm ERR!     /root/.npm/_logs/2020-06-21T09_58_27_941Z-debug.log
2020-06-21T09:58:28.7264460Z The command '/bin/sh -c npm install -g firebase-tools' returned a non-zero code: 1
2020-06-21T09:58:28.7264706Z �[0m
2020-06-21T09:58:28.7281969Z ##[warning]Docker build failed with exit code 1, back off 1.208 seconds before retry.
2020-06-21T09:58:29.9374851Z ##[command]/usr/bin/docker build -t 3888d3:c8ac01ba3f3548cdabe384e4965f3ee8 -f "/home/runner/work/_actions/w9jds/firebase-action/master/Dockerfile" "/home/runner/work/_actions/w9jds/firebase-action/master"
2020-06-21T09:58:29.9747718Z Sending build context to Docker daemon  10.75kB```

Deploy to Firebase fails: Error: An unexpected error has occurred.

Error Message

Deploy to Firebase

Error: An unexpected error has occurred.

Run w9jds/firebase-action@master

/usr/bin/docker run --name cbc08e7a8c8ada4ddcacce4cf2ae5cf190_8fac18 --label 8118cb --workdir /github/workspace --rm -e FIREBASE_TOKEN -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/myclub-app/myclub-app":"/github/workspace" 8118cb:c08e7a8c8ada4ddcacce4cf2ae5cf190 deploy --only hosting

Error: An unexpected error has occurred

Solution
If you have multiple hosting destinations, the deployment fails. so make sure, your .firebaserc & firebase.json file has just one destination for hosting.

Docker run failed with exit code 2

I have an error in deployment

Deploy to Firebase 3s
##[error]Docker run failed with exit code 2
Run w9jds/firebase-action@master
/usr/bin/docker run --name f6cdeb00472ea42cc5407c9e6da8273fb87b0e_c89d11 --label f6cdeb --workdir /github/workspace --rm -e FIREBASE_TOKEN -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/proj/proj":"/github/workspace" f6cdeb:00472ea42cc5407c9e6da8273fb87b0e deploy --only hosting:prod

=== Deploying to 'proj'...

i  deploying hosting

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/proj/overview

Error: An unexpected error has occurred.
##[error]Docker run failed with exit code 2

My workflow

name: Build and Deploy
on:
  push:
    branches:
      - master

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
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: build
          path: build
  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: build
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting:prod
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Not in a firebase app directory on a project generated from firebase init

Run w9jds/[email protected]
/usr/bin/docker run --name af96b4b1bb0a9277d1436495a5cb747b36f25f_d21aa3 --label af96b4 --workdir /github/workspace --rm -e FIREBASE_TOKEN -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/getting-things-done/getting-things-done":"/github/workspace" af96b4:b1bb0a9277d1436495a5cb747b36f25f deploy

Error: Not in a Firebase app directory (could not locate firebase.json)
##[error]Docker run failed with exit code 1
  1. I have exported my firebase token to a secret
  2. .firebaserc lives at the root level of my repository
  3. firebase.json lives at the root level of my repository

Not sure what's failing here.

Error: An unexpected error has occurred.

Hello, I'm trying to deploy my code using Github's actions to firebase.

I am receiving this error
Error: An unexpected error has occurred. ##[error]Docker run failed with exit code 2

my code for deploy is as following

 deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@v1
        with:
          name: dist
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting:***
        env:
          FIREBASE_TOKEN: ${{ secrets.firebase_token }}
          PROJECT_ID: ***

Can't add message (-m) to deploy command

Hi,
I am trying to add a message to the firebase deploy command as described in firebase doc:

uses: w9jds/firebase-action@master
      with:
        args: deploy -m "${{env.CI_FIREBASE_MESSAGE}}"

When running the pipeline, I am getting this error:

Error: Too many arguments. Run firebase help deploy for usage instructions
image

Should you add that as part of a new action environment variable?

Thank you

Deploy step failing for codebase in subdirectory

Hi! I'm having some trouble getting to run this action running with the deployable code stored in the ./client subfolder. It's always failing in the Deploy to Firebase step.

My main.yml file looks as follows:

name: Build and Deploy Gatsby Client
on:
  push:
    branches:
      - master
jobs:
  build-client:
    name: Build Client
    runs-on: ubuntu-latest
    steps:
      - name: Yarn Installation
        run: |
          mkdir ~/.npm-global
          npm config set prefix '~/.npm-global'
          export PATH=~/.npm-global/bin:$PATH
          source ~/.profile
          npm install -g yarn
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: |
          cd client
          yarn install
      - name: Build
        run: |
          cd client
          yarn build
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: built-client
          path: client/public
  deploy-client:
    name: Deploy Client
    needs: build-client
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@master
        with:
          name: built-client
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.CLIENT_FIREBASE_TOKEN }}
          PROJECT_ID: ${{ secrets.CLIENT_FIREBASE_ID }}
          PROJECT_PATH: ./client

My ./client/firebase.json:

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

And the error that I'm getting is:
Error: Specified public directory 'public' does not exist, can't deploy hosting to site ***

Thank you if you can help me to figure out what's not properly configured.

Action failing: "retries exhausted after 6 attempts"

This action started failing out of the blue about 2 weeks ago, each time the error message is:

Error: Task f1d5c11328b3858cac29a40918fc8b561a37dbc7ac9f9fa790dad54746afe2f8 failed: retries exhausted after 6 attempts
##[error]Docker run failed with exit code 1

Here's the full log: log.txt

Add PR data in Firebase Database

I am newbie for GitHub Actions, I wanted to add valid PR data into Firebase Database. Can you please suggest me way how it is possible?

Provide a tag so I don't have to build from master on every deploy

It'd be nice to have a tag to pull from instead of pulling and building from master on every build. On average my builds take 40-50 seconds to build the firebase action.

Is this possible? I know there are some other actions that I use that I don't have to build every time (actions/checkout, for example), but I've never published a GitHub Action myself so I'm not sure how to do it.

GCP_SA_KEY format?

Can you give an example of the GCP_SA_KEY format. No matter what I do I can't get it working.

When I copy my GCP SA Key ID I get this error: Error: Failed to authenticate, have you run firebase login?

When I copy the whole JSON as a secret I get the following: base64: invalid input

            - name: GitHub Action for Firebase
              uses: w9jds/[email protected]
              with:
                  args: deploy --only hosting
              env:
                  GCP_SA_KEY: ${{ secrets.GCP_SA_FIREBASE_CI_KEY }}

eslint inside functions directory and deploy with host assets

Sorry if i reopen this issue..... i have in functions/package.json the eslint . command, so how can i solve this error without delete the configuration ?

i  deploying functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /github/workspace/functions
> eslint .

sh: eslint: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! functions@ lint: `eslint .`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2020-09-03T12_50_56_138Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

Error: Not in a Firebase app directory (could not locate firebase.json)

When I run the action, it says Error: Not in a Firebase app directory (could not locate firebase.json)

How can I set the path to look for project file?

name: CI

on: 
  push:
    branches:
    - master

jobs:
  build:

    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v1
    - name: GitHub Action for Firebase
      uses: w9jds/firebase-action@7d6b2b058813e1224cdd4db255b2f163ae4084d3
      env:
        FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
      with:
        args: deploy

The firebase.json is in \src folder of the repo, and the folder with the content below.

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

image

The action has stopped working

I have been using this action in multiple repositories.

Since yesterday(4/16/20) it does not work anymore and fail with the following error:

Error: An unexpected error has occurred.

It fails on multiple repositories where no configuration has been changed, so i believe it isn't related to issue #23 .

Error: firebase use must be run from a Firebase project directory

I keep running into this error with a workflow I'm trying to setup.

I can confirm firebase.json is indeed in the main repo directory. And the same repo runs firebase commands (ie firebase use) locally with no issues.

I'm new to Github Actions, so may have missed something?!

This is the debug log from the last Github Action

/usr/bin/docker run --name e5c35409207c72d03464f95ff6469bda12cf7_d1057e --label 1e5c35 --workdir /github/workspace --rm -e PROJECT_ID -e BUCKET -e FIREBASE_TOKEN -e CLOUDSDK_METRICS_ENVIRONMENT -e GCLOUD_PROJECT -e GOOGLE_APPLICATION_CREDENTIALS -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_DEBUG -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/my-app-v2/my-app-v2":"/github/workspace" 1e5c35:409207c72d03464f95ff6469bda12cf7 auth:export ./auth.json
setting firebase project to my-app

Error: firebase use must be run from a Firebase project directory.

Run firebase init to start a project directory in the current folder.

How to work with this secret.FIREBASE_TOKEN in angular

I'm using angular to make and firebase to host my website and I've got my login token but I wouldn't know where to put it. I was thinking that the secret.FIREBASE_TOKEN looks like some sort of env file but I don't understand how he can read that file since it contains secrets and you don't want to upload such a file right?

npm ERR! enoent Error while executing

Step 11/15 : RUN npm install -g firebase-tools
 ---> Running in 9add85bc17c0
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -2
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/DABH/diagnostics.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-22T06_34_33_145Z-debug.log
The command '/bin/sh -c npm install -g firebase-tools' returned a non-zero code: 254

##[error]Docker build failed with exit code 254

Once again. Worked few hours ago.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.