Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
Test, build, and deploy your applications to Firebase by adding a pipe to your Bitbucket Pipelines configuration.
A full end-to-end example is available in this repository if you prefer hands-on experimentation with deploying to Firebase using Pipelines and Pipes
Define the following two variables in your settings:
Name | Value |
FIREBASE_TOKEN | Firebase CLI token. Use a secured variable for this so that it is masked and encrypted in your logs. |
FIREBASE_PROJECT | Firebase project name. If you don’t have a project yet, you should go to the Firebase console and create one. |
You can define these variables at the deployment environment, repository, or team level.
The next steps presume you have installed the Firebase CLI.
Your project should contain a firebase.json file containing your Firebase configuration.
This file is generated automatically after you locally run:
1
firebase init
Here’s the firebase.json file from our example repository:
firebase.json'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"hosting": {
"headers": [
{"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
],
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Then we add the deployment configuration in your bitbucket-pipelines.yml file. We've included the deployment: keyword so that Bitbucket Deployments can track your deployment.
Below is a sample Bitbucket Pipelines configuration that deploys a ReactJS application (created with create-react-app), to Firebase. This example also provides insights on some best practices, like having separate steps for building and deploying, and using Bitbucket Deployments to review the deployment.
bitbucket-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
image: node
pipelines:
default:
- step:
name: Test
script:
- npm install && npm test
- step:
name: Build
script:
- npm install && npm run build
artifacts:
- build/**
- step:
name: Deploy to Firebase
deployment: production
script:
- pipe: atlassian/firebase-deploy:0.2.1
variables:
FIREBASE_TOKEN: $FIREBASE_TOKEN
PROJECT_ID: $FIREBASE_PROJECT
Now when you commit your code, you can watch your test, build, and deploy steps as they progress. When it reports success, your application will be up and running in Firebase.
Was this helpful?