What is CI (continuous integration)
Continuous integration refers to the build and unit testing stages of the software release process.
Every revision that is committed triggers an automated build and test.
Travis CI + Github + Firebase + Angular 2
- Firebase init in project
- Writing code in local repo
- Pushing to Github repo
- Building code production in Travis CI
- Deploying production code to Firebase hosting
Firebase init
Before using Google Firebase, need to apply for
firebase account.
There are many features which Firebase provides for us, such as Authentication,
Database, Storage, Hosting…
In this blog, only need to use Hosting feature, which is free.
Do the Firebase initialization in the existing project directory
|
|
Following the firebase init
instruction to config your project,
for my case, I’m building an Angular2 project, so I choose dist
as my public
directory.
After the initialization, need an access token for CI as environment variable.
Using with CI Systems
then do a deploy test:
|
|
Using Travis CI
Greate documentation the complete beginner here
- Connecting Github account to Travis CI
- Choosing Github project repo to async
- Setting Firebase Token as the environment variable in Travis
- Writing a
travis.yml
config file in your project directory
Customizing the Build
In order to deploy project from Travis, inside the travis.yml
, add:
|
|
write script to build your project:
|
|
Push change to Github, build prod on Travis CI, Deploy to Firebase
Done!
Everything is automated!
Awesome! 😎
近期评论