What is the syntax for pipeline.yml to deploy to Firebase?

Robyn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2019
Hello,
I've been using pipelines to deploy to Heroku with great success.  It's a fantastic feature.
I am now trying to setup a pipeline for my React app on Firebase.

Below is the pipeline.yml file I'm using for my master;
#pipeline file
image: node:8.12.0
pipelines:
    branches:
        master:
            - step:
               deployment: production
                   caches:
                       - node
                             script: # Modify the commands below to build your repository. 
                                   - npm install -g firebase-tools
                                   - npm install
                                   - npm build && firebase deploy --token=$FIREBASE_TOKEN --project $FB_PROJECT --public build

I've tried multiple variations on the syntax above, each time I get an error that the "build" folder cannot be found.

Would anyone happen to know the correct syntax?
When I deploy locally, it is simply "npm build && firebase deploy".

Thank you in advance!

1 answer

1 accepted

2 votes
Answer accepted
Linette
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 16, 2019

It might be worth you using the firebase deploy pipe to simplify things: https://bitbucket.org/atlassian/firebase-deploy/src/master/README.md

that way you could have:

    - step:
        name: Deploy to production
        deployment: production
        script:
          - pipe: atlassian/firebase-deploy:0.2.1
            variables:
              FIREBASE_TOKEN: $FIREBASE_TOKEN
              PROJECT_ID: $FIREBASE_PROJECT

Define two variables in your settings for your Firebase repository: FIREBASE_TOKEN and PROJECT_ID  (Firebase project name)


(here's an example repo if it helps? https://bitbucket.org/bitbucketpipelines/example-firebase-deploy/src/master/bitbucket-pipelines.yml)

vivrajagopal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2019

Thanks Linette, this worked like a charm!

Just wanted to add that the "Build" step can fail if there are warnings present as "warnings are treated as errors". Silly oversight on my part, but that tripped me up for a little while.

brian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 3, 2019

Is there a way to define what directory this pipe works on in a large mono repo?

Example: "/repo/frontend/website" instead of "/repo"

Also, in a multi deployment setup, this pipe errors as it is looking in repo variables, not environment variables.  This causes issues because the deployment is tied to different Firebase projects.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events