23

I'm having trouble deploying travis CI with firebase using these firebase commands:

firebase deploy --email ${FIREBASE_USERNAME} --password ${FIREBASE_PASSWORD}
firebase deploy --token ${FIREBASE_TOKEN}

It does not like --email option and it does seem that it takes --token but does not work with my firebase auth token I can get from my firebase app. What am I doing wrong?

1

2 Answers 2

67

The email option was removed in the 2.0 release of the CLI.

Use firebase login:ci to generate a token.

  1. On a machine with a browser, install the Firebase CLI.
  2. Run firebase login:ci to log in and print out a new access token (the current CLI session will not be affected).
  3. Store the output token in a secure but accessible way in your CI system.
2
  • 4
    But the access token expires after a month. Anyone know a way around that? Mar 26, 2016 at 9:18
  • 4
    firebase deploy --token "$FIREBASE_TOKEN" --non-interactive May 15, 2017 at 22:14
0

Another firebase deployment option in travis-ci is to use dpl (https://github.com/travis-ci/dpl) which is a deployment provider

OPTIONS

  • token: Your Firebase CI Access Token (generated from firebase login:ci)
  • project: Deloy to a different Firebase Project than specified in firebase.json
  • public: Specifies which directory to upload to Firebase Hosting.
  • ignore: Specifies the files to ignore on deploy. (similar to .gitignore)

EXAMPLE

dpl --provider=firebase --token=<token> --project=<project>

What is really cool about using this deployment provider utility is that you can deploy to one or more firebase hosted applications from a single project commit...

after_script:
  - dpl --provider=firebase --token=${FIREBASE_TOKEN} --project=${PROJECT_ONE}
  - dpl --provider=firebase --token=${FIREBASE_TOKEN} --project=${PROJECT_TWO}

References:

Note: One thing you will need to consider is how you set FIREBASE_URL as a constant in each hosted application if they need to use the same code base but a separate Firebase for storing data.

3
  • 1
    I have 5 firebase projects that have the same code, can I update all 5 projects from single GitHub repo from Travis?? and that FIREBASE_TOKEN is unique or I need for every project to generate tokens?
    – user6600549
    May 20, 2017 at 14:12
  • that PROJECT_ONE you say what is ? the name of my firebase project the URL of that project ??
    – user6600549
    May 20, 2017 at 14:15
  • I'm getting ⚠ Your CLI authentication needs to be updated to take advantage of new features. ⚠ Please run firebase login --reauth Nov 18, 2017 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.