With simplicity laying at its core, Slack has always seemed like a perfect complement to Buddy. And so it happened: with over 50% share in active accounts, it is our most popular integration of all-time.

The most common use-case for Slack and Buddy is sending notifications on finished builds and deployments to your team channel. Not many developers know, however, that you can also run deployments directly from Slack:

Use case: a WordPress Project

Let’s assume you have a WordPress application with the following delivery workflow:

  1. Prepare assets by running tasks in Gulp
  2. Deploy compiled assets to FTP server
  3. Notify your team of finished deployment or send message to QA that something went wrong

With Buddy, you can trigger all of the above with a simple run command.

Before you start, make sure that Slash command integration is enabled in Slack.

Set up a project with Buddy

  1. Sign up to Buddy with your GitHub/Bitbucket account or email
  2. Create a new project, select your Git provider, and choose your project:

For the purpose of this guide we’ll use a Git repository with an existing WP theme: https://github.com/buddy-works/buddy-wp-theme.git

Set up a delivery pipeline

Now let’s add a delivery pipeline that will build and deliver your project upon receiving the command:

  1. Click Add a new pipeline
  2. Set the trigger mode to ‘On click’
  3. Select the branch from which you want to deploy
  4. Click Add a new pipeline when ready

Define the delivery actions

Now it’s time to reproduce your workflow into actions:

  1. Add a build action to process your files before the deployment. In this example we’ll use Gulp to compile SCSS to CSS.
  2. Add a transfer action to your type of server. In this example we’ll deploy to FTP.
  3. Add the Slack action to receive notifications of finished deployments. You can also add a second notification in the ‘Actions run on failure’ section that will send a custom message in case something goes wrong (eg. the build has failed)

You don’t have to add Slack actions to a pipeline to be able to run the pipeline. However, we do recommend adding so that you know what’s going on in your project.

When you’re done, the whole pipeline will look like this:

Run the pipeline from Slack

If your Slack command integration is properly configured, fire up your Slack and enter the command to run the deployment:

/[pipeline_name] run

where pipeline_name is the name of the command that you’ve entered in your Slash commands integration.

Congratulations! You have just mastered Slack to an extent you don’t even have to leave it to build and deploy WordPress. How many developers do you know who can do that?

Appendix

Here is the complete list of actions that you can run with slash commands:

  • /[name] status – displays pipeline status
  • /[name] run – runs execution
  • /[name] cancel – cancels execution (must be in progress)
  • /[name] refresh – refreshes execution
  • /[name] retry – runs execution again (must be terminated or canceled)
  • /[name] clear run – deploy and refresh can be used with the clear cache trigger
  • /[name] refresh 1c002dd – deploy and refresh can be used with any revision
  • /[name] clear run 1c002dd – clear and revision can be run together