azureazure-pipelinesazure-pipelines-release-pipelinefirebase-toolsfirebase-app-distribution

Authenticate and use Firebase in non-interactive environments


I work with Android mobile application, where source code is maintained in Azure. I want to automate the build process and upload the .apk file in Firebase App Distribution, as per the requirment.

I used Azure Pipeline to automate the build process. Am using .yml file to automate the process. Were able to generate the .apk file. I need to upload this to Firebase.

Followed few blogs and ends up with below code that needs to be written in my .yml file

- script: |
    cd functions
    npm init --yes
    npm install -g firebase-tools
    npm install
    firebase login --interactive
    firebase appdistribution:distribute --app APP_ID --release-notes "My first distribution" --testers "xyzh@gmail.com" $(build.artifactStagingDirectory)$(Build.ArtifactStagingDirectory)/android-devops.apk
  displayName: 'npm install and deploy'

With this, couldn't login into firebase, since there will be no interaction on run. It is completely automated by Azure on running the job. If I used these commands in command prompt, it open firebase login page and on login it got authentication. After that appdistribution:distribute command uploads the application to Firebase successfully. But I need to automate this process in Azure Devops Pipeline, where there will be no interactions.


Solution

  • Please try to generate an authentication token first, and then use either of the following two options:

    enter image description here

    https://firebase.google.com/docs/cli/#command_reference