Integrate Wercker with Bitbucket, Firebase and Slack

pradeep singh
Jul 30, 2017 · 3 min read

Introduction

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 )

Bitbucket

  • Create Repository on Bitbucket if already not have.

Wercker

  • Create Continuous integration app at “Wercker”
  • Select Bitbucket, type repository name, select it and click “Use selected repo”
  • Select recommended option
  • Finish
  • 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

Firebase

  • As soon as build finishes successfully a new build will be uploaded to firebase hosting

Slack

  • 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.

Wercker documentation

Firebase Hosting documentation

Wercker.yml

pradeep singh

Written by

Software Engineer — pradeep.stackskull.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade