{"id":13804915,"url":"https://github.com/mainmatter/ember-cli-deploy-webhooks","last_synced_at":"2025-05-13T18:33:01.441Z","repository":{"id":57223203,"uuid":"44606982","full_name":"mainmatter/ember-cli-deploy-webhooks","owner":"mainmatter","description":"Ember CLI Deploy plugin for calling webhooks during deployments","archived":true,"fork":false,"pushed_at":"2020-04-09T13:47:23.000Z","size":320,"stargazers_count":17,"open_issues_count":3,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-07T06:39:53.686Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mainmatter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-20T13:09:20.000Z","updated_at":"2025-03-03T16:57:50.000Z","dependencies_parsed_at":"2022-08-24T15:41:42.127Z","dependency_job_id":null,"html_url":"https://github.com/mainmatter/ember-cli-deploy-webhooks","commit_stats":null,"previous_names":["simplabs/ember-cli-deploy-notifications","simplabs/ember-cli-deploy-webhooks"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mainmatter%2Fember-cli-deploy-webhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mainmatter%2Fember-cli-deploy-webhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mainmatter%2Fember-cli-deploy-webhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mainmatter%2Fember-cli-deploy-webhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mainmatter","download_url":"https://codeload.github.com/mainmatter/ember-cli-deploy-webhooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003468,"owners_count":21997891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:00:55.334Z","updated_at":"2025-05-13T18:33:01.060Z","avatar_url":"https://github.com/mainmatter.png","language":"JavaScript","readme":"# ember-cli-deploy-webhooks [![Build Status](https://travis-ci.org/simplabs/ember-cli-deploy-webhooks.svg)](https://travis-ci.org/simplabs/ember-cli-deploy-webhooks)\n\n\u003e An ember-cli-deploy plugin to notify external services (e.g. an error\n\u003e tracking service) of successful hook executions in your deploy pipeline.\n\n[![](https://ember-cli-deploy.github.io/ember-cli-deploy-version-badges/plugins/ember-cli-deploy-webhooks.svg)](http://ember-cli-deploy.github.io/ember-cli-deploy-version-badges/)\n\n## What is an ember-cli-deploy plugin?\n\nA plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.\n\nFor more information on what plugins are and how they work, please refer to the [Plugin Documentation][1].\n\n## Quick Start\n\nTo get up and running quickly, do the following:\n\n- Install this plugin\n\n```bash\n$ ember install ember-cli-deploy-webhooks\n```\n- Place the following configuration into `config/deploy.js`\n\n\n```javascript\nENV.webhooks = {\n  services: {\n    \"\u003csome-key\u003e\": {\n      url: \u003cservice-url\u003e,\n      headers: {\n        // custom headers go here\n      },\n      method: '\u003chttp-method\u003e', // defaults to 'POST'\n      body: function(/*context*/) {\n        // return any object that should be passed as request body here\n        return {\n          apiKey: \u003cyour-api-key\u003e\n        };\n      },\n      didActivate: true\n    }\n  }\n}\n```\n\n- Run the pipeline\n\n```bash\n$ ember deploy\n```\n\n## ember-cli-deploy Hooks Implemented\n\nFor detailed information on what plugin hooks are and how they work, please refer to the [Plugin Documentation][1].\n\n- `configure`\n- `setup`\n\n_Hooks that can be used for webhooks:_\n\n- `willDeploy`\n- `willBuild`\n- `build`\n- `didBuild`\n- `willPrepare`\n- `prepare`\n- `didPrepare`\n- `willUpload`\n- `upload`\n- `didUpload`\n- `willActivate`\n- `activate`\n- `didActivate`\n- `teardown`\n- `fetchRevisions`\n- `displayRevisions`\n- `didFail`\n\n## Configuration Options\n\nFor detailed information on how configuration of plugins works, please refer to the [Plugin Documentation][1].\n\n### services\n\nAn object that identifies all webhooks you want to notify. You will put a key for every service you want to call on deploy here.\n\nA `service` configuration needs to provide four properties as configuration for\n`ember-cli-deploy-webhooks` to know how to notify the service correctly:\n\n- `url` The url to call\n- `method` The HTTP-method to use for the call (defaults to `'POST'`)\n- `headers` A property to specify custom HTTP-headers (defaults to `{}`)\n- `body` The body of the request\n- `auth` used for http-authentication\n- `critical` if true, webhook failures will abort deploy\n\n`auth` should be a hash containing values:\n\n* `user` || `username`\n* `pass` || `password`\n\nBearer authentication is also supported. Please refer to\n[request](https://github.com/request/request#http-authentication)'s docs for\nmore details as `ember-cli-deploy-webhooks` uses `request` internally.\n\n\u003chr/\u003e\n**Whenever one of these properties (except `auth`) returns a _falsy_ value, the service will _not_ be\ncalled.**\n\u003chr/\u003e\n\nAll these properties can return a value directly or can be implemented as\na function which returns the value for this property and gets called with the\ndeployment context. The `this` scope will be set to the service config object\nitself.\n\n*Example:*\n\n```javascript\nENV.webhooks = {\n  services: {\n    slack: {\n      webhookURL: '\u003cyour-webhook-url\u003e',\n      url: function() {\n        return this.webhookURL;\n      },\n      method: 'POST',\n      headers: {},\n      body: function(context) {\n        var deployer = context.deployer;\n\n        return {\n          text: deployer + ' deployed a new revision'\n        }\n      }\n    }\n  }\n};\n```\n\nAdditionally you have to specify on which hook to notify the service in the\ndeploy pipeline. To do this you can simply pass a truthy value as a property\nnamed the same as the hook at which you want to notify the service. This can\nals be used to override the defaults that you specify on a service.\n\n*Example:*\n\n```javascript\n  ENV.webhooks = {\n    services: {\n      slack: {\n        url: 'your-webhook-url',\n        method: 'POST',\n        headers: {},\n        body: {\n          text: 'A new revision was activated!'\n        },\n        didActivate: true\n        didDeploy: {\n          body: {\n            text: 'Deployment successful!'\n          }\n        },\n        didFail: {\n          body: {\n            text: 'Deployment failed!'\n          }\n        }\n      }\n    }\n  };\n```\n\nThere are two types of services you can specify in the `services` property:\n\na)  __preconfigured services__\n\nPreconfigured services only need to be passed service specific configuration\noptions. This depends on the service (see below) but you can also provide all\nother service configuration properties that were explained before to override\nthe defaults.\n\n*Example:*\n\n```javascript\nENV.webhooks = {\n  services: {\n    bugsnag: {\n      url: 'https://bugsnag.simplabs.com/deploy',\n      apiKey: '1234',\n      didActivate: true\n    }\n  }\n};\n```\n\nPreconfigured services aren't very special but maintainers and contributors\nhave already provided a base configuration that can be overridden by the\nplugin users. This for example is basically the default implementation that is\nalready configured for the slack service:\n\n```javascript\n  ENV.webhooks.services = {\n    // ...\n    slack: {\n      url: function() {\n        return this.webhookURL;\n      },\n      method: 'POST',\n      headers: {}\n    }\n  };\n```\n\nUsers then only have to provide `webhookURL` and a `body`-property for the\nhooks that should send a message to slack.\n\n*Example:*\n\n```javascript\n  ENV.webhooks.services = {\n    slack: {\n      webhookURL: '\u003cyour-slack-webhook-url\u003e',\n      didActivate: {\n        body: {\n          text: 'A new revision was activated!'\n        }\n      }\n    }\n  };\n```\n\nCurrently available preconfigured services are:\n\n- `bugsnag` [An error-tracking service](https://bugsnag.com)\n- `slack` [The popular messaging app](https://slack.com/)\n\n#### bugsnag\n\nTo configure bugsnag you need to at least provide an `apiKey` and specify\na hook on which bugsnag should be notified of a deployment. You'll most likely\nwant to notify bugsnag of a deployment in the `didActivate`-hook as this is the\nhook that actually makes a new version of your app available to your users.\n\n*Example:*\n\n```javascript\n  ENV.webhooks.services = {\n    bugsnag: {\n      apiKey: '\u003cyour-api-key\u003e',\n      didActivate: true\n    }\n  };\n```\n\n__Required configuration__\n\n- `apiKey` The api-key to send as part of the request payload (identifies the\n  application)\n\n__Default configuration__\n\n```\n  ENV.webhooks.services = {\n    bugsnag: {\n      url: 'http://notify.bugsnag.com/deploy',\n      method: 'POST',\n      headers: {},\n      body: function() {\n        var apiKey = this.apiKey;\n\n        if (!apiKey) { return; }\n\n        return {\n          apiKey: this.apiKey,\n          releaseStage: process.env.DEPLOY_TARGET\n        }\n      }\n    }\n  }\n```\n\n#### slack\n\n*Example:*\n\n```javascript\n  ENV.webhooks.services = {\n    slack: {\n      webhookURL: '\u003cyour-slack-webhook-url\u003e',\n      didActivate: {\n        body: {\n          text: 'A new revision was activated!'\n        }\n      }\n    }\n  };\n```\n\n__Required configuration__\n\n- `webhookURL` The [incoming webhook's](https://api.slack.com/incoming-webhooks)-url that should be called.\n\n- `body` You need to provide a payload that gets send to slack. Please refer to\n  the [documentation](https://api.slack.com/incoming-webhooks) on how message\npayloads can be used to customize the appearance of a message in slack. At\nleast you have to provide a `text` property in the payload.\n\n__Default configuration__\n\n```javascript\n  ENV.webhooks.services = {\n    // ...\n    slack: {\n      url: function() {\n        return this.webhookURL;\n      },\n      method: 'POST',\n      headers: {}\n    }\n  };\n```\n\nb) __custom services__\n\nCustom services need to be configured with a `url` and `body` property.\n`headers` will default to `{}` and `method` will default to `'POST'`. All these\noptions can be overridden as described before of course.\n\n*Example:*\n\n```javascript\nENV.webhooks = {\n  services: {\n    simplabs: {\n      url: 'https://notify.simplabs.com/deploy',\n      body: function(context) {\n        var deployer = context.deployer;\n\n        return {\n          secret: 'supersecret',\n          deployer: deployer\n        }\n      },\n      didActivate: true\n    },\n    newRelic: {\n      url: 'https://api.newrelic.com/deployments.json',\n      headers: {\n        \"api-key\": \"\u003cyour-api-key\u003e\"\n      },\n      method: 'POST',\n      body: {\n        deployment: {\n          // ...\n        }\n      },\n      didDeploy: true\n    }\n  }\n};\n```\n\n### httpClient\n\nThe underlying http-library used to send requests to the specified services. This allows users to customize the library that's used for http requests which is useful in tests but might be useful to some users as well. By default the plugin uses [request](https://github.com/request/request).\n\n## Running Tests\n\n- `yarn test`\n\n[1]: http://ember-cli-deploy.com/docs/v0.6.x/plugins-overview/ \"Plugin Documentation\"\n\n## License\n\nember-cli-deploy-webhooks is developed by and \u0026copy;\n[simplabs GmbH](http://simplabs.com) and contributors. It is released under the\n[MIT License](https://github.com/simplabs/ember-cli-deploy-webhooks/blob/master/LICENSE).\n","funding_links":[],"categories":["Packages"],"sub_categories":["Automation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainmatter%2Fember-cli-deploy-webhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmainmatter%2Fember-cli-deploy-webhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmainmatter%2Fember-cli-deploy-webhooks/lists"}