Wercker is a Continuous integration and Deployment system. In this post we will be using Wercker to deploy changes as soon as they pushed on Bitbucket repository’s master branch to domain hosted at Firebase and then notifying other(team members etc) about the new deployment changes in Slack.
Things we will use
- Bitbucket (Need to have a repository hosted at bitbucket either public/private)
- Wercker (Need to have account on wercker, if not create one ;))
- Firebase (Need to have a domain hosted at firebase, if not host one ;))
- Slack (Need to have a slack web hook, create one )
- Create Repository on Bitbucket if already not have.
- Create Continuous integration app at “Wercker”
- Select Bitbucket, type repository name, select it and click “Use selected repo”
- Select recommended option
- Add new pipeline “deploy-firebase”
- Enter pipeline details and “Hook type” Default
- Add “FIREBASE_PROJECT_NAME” and “FIREBASE_TOKEN” as environment variable for “deploy-firebase” pipeline
- For “FIREBASE_TOKEN”, open terminal and type
$firebase login:ci, login to account and after successful login token will get printed in same terminal, copy token and save as protected variable.
- After setting variables, your setting will look something like below
- Lets chain “deploy-firebase” pipeline after “build” pipeline finishes on master branch
- Your pipelines will look something like below
- Add “Wercker.yml” to your repository root and file will look something like below
- Go to Webhook Api and create slack app, login into your slack team and then go to “incoming-hooks” and create new hooks, after creation your hook will look something like below
- You can also restrict build trigger on particular branch e.g. “website” branch is restricted as below
- Lets commit some changes to “master” branch of your bitbucket repository and as soon as changes are up build will trigger automatically
- As soon as build finishes successfully a new build will be uploaded to firebase hosting
- After build finishes, slack hook will post a message to let the team know that a new build is release with appropriate message which build success or error.