Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Auto Deploy to Firebase Notes

Chuck Horton edited this page Jan 14, 2016 · 2 revisions

To auto deploy PSK using Travis-CI you need to do the following:

  1. Use firebase login:ci to generate authentication token
  2. Add Environment Variable called FIREBASE_TOKEN, put generated token in Value field
  3. Make sure you put double quotes around token in Value field
  4. Go to https://travis-ci.org/PolymerElements/polymer-starter-kit/settings to do so
  5. Do not use --non-interactive option for firebase deploy when using a token. It causes authentication error
  6. Don't put {} around $FIREBASE_TOKEN as some of the examples show

Firebase deploy

See current at https://github.com/PolymerElements/polymer-starter-kit/blob/master/travis-runner.sh#L23

deploy_firebase () {
    # Deploying to Firebase! (https://polymer-starter-kit.firebaseapp.com)
    echo Deploying to Firebase
    # Making Changes to PSK for Firebase
    sed -i.tmp 's/<!-- Chrome for Android theme color -->/<base href="\/">\'$'\n<!-- Chrome for Android theme color -->/g' app/index.html
    sed -i.tmp "s/hashbang: true/hashbang: false/" app/elements/routing.html
    cp docs/firebase.json firebase.json
    # Starting Build Process for Firebase Changes
    gulp
    # Starting Deploy Process to Firebaseapp.com Server -- polymer-starter-kit.firebaseapp.com
    firebase deploy --token "$FIREBASE_TOKEN" -m "Auto Deployed by Travis CI"
    # Undoing Changes to PSK for Firebase
    cp app/index.html.tmp app/index.html
    cp app/elements/routing.html.tmp app/elements/routing.html
    rm app/elements/routing.html.tmp
    rm app/index.html.tmp
    rm firebase.json
  }