Firebase Deployment
This page documents deployments using the dpl v2. Please see our blog post for details. You can check previous dpl v1 documentation here.
Travis CI can automatically deploy to Firebase after a successful build.
For a minimal configuration, add the following to your .travis.yml
:
deploy:
provider: firebase
token: <encrypted token>
edge: true # opt in to dpl v2
Status #
Support for deployments to Firebase is stable.
Known options #
Use the following options to further configure the deployment.
token |
Firebase CI access token (generate with firebase login:ci) — required, secret, type: string |
project |
Firebase project to deploy to (defaults to the one specified in your firebase.json) — type: string |
message |
Message describing this deployment. — type: string |
only |
Firebase services to deploy — type: string, note: can be a comma-separated list |
force |
Whether or not to delete Cloud Functions missing from the current working directory — type: boolean |
Shared options #
cleanup |
Clean up build artifacts from the Git working directory before the deployment — type: boolean |
run |
Commands to execute after the deployment finished successfully — type: string or array of strings |
Environment variables #
All options can be given as environment variables if prefixed with FIREBASE_
.
For example, token
can be given as FIREBASE_TOKEN=<token>
.
Securing secrets #
Secret option values should be given as either encrypted strings in your build
configuration (.travis.yml
file) or environment variables in your repository
settings.
Environment variables can be set on the settings page of your repository, or
using travis env set
:
travis env set FIREBASE_TOKEN <token>
In order to encrypt option values when adding them to your .travis.yml
file
use travis encrypt
:
travis encrypt <token>
Or use --add
to directly add it to your .travis.yml
file. Note that this command has to be run in your repository’s root directory:
travis encrypt --add deploy.token <token>
Generating a Firebase token #
Generate your Firebase token after installing the Firebase tools by running:
Run this command to generate a token (e.g. 1/AD7sdasdasdKJA824OvEFc1c89Xz2ilBlaBlaBla
)
firebase login:ci
Deploying to a custom project #
To deploy to a different project than the one specified in the firebase.json
,
use the project
option:
deploy:
provider: firebase
# ⋮
project: <project>
Adding a message to a deployment #
To add a message to describe the deployment, use the message
option:
deploy:
provider: firebase
# ⋮
message: <message>
Pull Requests #
Note that pull request builds skip the deployment step altogether.