Travis CI integration
Firebase CLI, can give you a key for continuous integration like travis. See https://docs.travis-ci.com/user/deployment/firebase/​
1
firebase login:ci
Copied!
In travis config, can add ENV FIREBASE_TOKEN.
In .travis.yml
1
...
2
​
3
install
4
- nom install -g firebase-tooltos
5
​
6
after_success:
7
- firebase deploy --token $FIREBASE_TOKEN
8
...
Copied!

Travis CLI

Alternatively, after you generate the Firebase token from running the login:ci command, install travis CLI and do:
1
travis encrypt "<FIREBASE_TOKEN>" --add
2
# This command may generate a warning ("If you tried to pass the name of the repository as the first argument, you probably won't get the results you wanted"). You can ignore it.
Copied!
This will add the encrypted secure token to your Travis config file.

.env file with secure tokens

If you have a .env file that stores all your configuration, you should also do this:
1
travis encrypt-file .env --add
Copied!
This will create an .env.enc file, and the step to decode is added to your Travis config file. You should commit the .env.enc to your Github repository.
Note: that there is a known bug with Travis version 1.8.11 , and you would need to install 1.8.10 instead.

Deploying specific services (hosting, functions, firestore)

If you want to deploy only to specific services - e.g. hosting or otherwise - you need to get the edge version of the dpl tool in Travis. This just means you need to add the following to your config:
1
deploy:
2
provider: firebase
3
edge:
4
branch: master
5
...
6
Copied!
This would then allow you to use Firebase CLI's only option:
1
deploy:
2
provider: firebase
3
edge:
4
branch: master
5
project: dev # the default project will be selected from firebase.json
6
only: hosting:digital-paper-edit-dev
Copied!
.travis.yml
1
language: node_js
2
node_js:
3
- '10'
4
cache:
5
directories:
6
- node_modules
7
before_script:
8
- yarn install
9
script:
10
- CI=false yarn build # ignore build warnings
11
deploy:
12
provider: firebase
13
edge:
14
branch: master
15
token:
16
secure: cEpLS+5f3V1CZ24Tr7U+9p0ajX9jReRUEXfmAiXn4Pe4Cl4C7zLeoSRlPc/id0ux3VjhSFArkrhA2VYOUoyk+lkZgxhnP5yRxS/6E0vye5Y5eot36HHBuynFTPKv+JLJfaD9d0MX6CBoxZoU7kkXt+GDx5tvATHfmrXWEyETmAc7qKpinlQk9HWBFEouxlbzrY01pQiNLHf9+BFTaYwlqutLuy24i6cARdi+fXdaQyzFw2BMlQK1AHBhxdOIB96l8/eUvC89AE/uISP8+4lTNFMTAn8anOv+oUwa5hdxh5GdmjCj/AqdwyPThiTu1wNd7Uk/VPSHsG0lpmbCy7rr5d783+2qC0SG0KdX2NOkPqgWPSOVmO44suCtD2j9Mh5xOrs9Kib9VwSsqqKqItv/EX7BJyzS3ixA8CrSlLaqo6mGLreWkzTdDv19ArU1YfSIdUOwrybq5zpaooQnyNfgP7sT3cNcreBqI8tvhU+GDI/aWDgxwAqPEyEsWqSPSfvQuXda5BJAf6LyRIKIzJTtVRfnXI7AMeHYV7+m3vTcrIh5XXGXj+mMYTU+vliuqLNADmuqdepeIZ/Y6b2UNRKQu6jB5jYCftY0YJH8SHlDU2skevqEYjw0KwMP461uyLBnB26ydmkxx3ptz56jqL5odAoSzK3bwiaXYJ5UlrBVaS8=
17
message: this is an automatic deployment to dev by travis - CI as a result of pushing
18
to master
19
project: dev
20
only: hosting:digital-paper-edit-dev
21
before_install:
22
- openssl aes-256-cbc -K $encrypted_3c84dcdc6bbe_key -iv $encrypted_3c84dcdc6bbe_iv
23
-in .env.enc -out .env -d # automatically added by encrypt-file
Copied!
You can see the full file here.
​
Last modified 1yr ago