Ember CLI Deploy Slack Plugin

2.0.0 · active · verified Wed Apr 22

ember-cli-deploy-slack is an ember-cli-deploy plugin designed to send deployment notifications to Slack. It integrates deeply into the `ember-cli-deploy` pipeline, providing hooks to send customizable messages for various stages such as `didDeploy` and `didFail`. The current stable version is 2.0.0, which includes updated dependencies and Node.js version requirements. As an Ember CLI Deploy plugin, its release cadence is typically aligned with the broader Ember ecosystem and major dependency updates. Its key differentiator is its seamless integration with the `ember-cli-deploy` context, allowing dynamic message generation using deployment-specific data, and leveraging `node-slackr` for flexible Slack message formatting.

Common errors

Warnings

Install

Imports

Quickstart

Installs the plugin, configures a basic Slack webhook and custom `didDeploy` message in `config/deploy.js` with environment variable handling for the webhook URL, and demonstrates running a production deployment.

// config/deploy.js
module.exports = function(deployTarget) {
  var ENV = {
    slack: {
      webhookURL: process.env.SLACK_WEBHOOK_URL ?? 'YOUR_SLACK_WEBHOOK_URL', // Use env var for security
      channel: '#deployments',
      username: 'EmberDeployBot',
      iconEmoji: ':rocket:',
      // Example of a custom message for successful deployments
      didDeploy: function(context) {
        return function(slack) {
          const projectName = context.project.name();
          return slack.notify({
            text: `:white_check_mark: ${projectName} deployed to ${deployTarget}!`, 
            attachments: [
              { text: `Revision: ${context.revisionData.revisionKey}` }
            ]
          });
        };
      }
    }
  };

  if (deployTarget === 'production') {
    ENV.slack.channel = '#production-deploys';
  }
  return ENV;
};

// Terminal
// $ ember install ember-cli-deploy-slack
// $ SLACK_WEBHOOK_URL="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" ember deploy production

view raw JSON →