You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-1Lines changed: 28 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,34 @@ ENV.slack = {
98
98
```
99
99
100
100
Notification hooks will be passed the deployment context and the slackNotifier
101
-
utility class. The SlackNotifier uses [node-slackr](https://github.com/chenka/node-slackr) under the hood so you can use its `notify`-function accordingly. This enables you to customize your messages in any way possible. You can even add custom properties to the deployment context if that's what you need to do.
101
+
utility class. The SlackNotifier uses [node-slackr](https://github.com/chenka/node-slackr) under the hood so you can use its `notify`-function accordingly. This enables you to customize your messages in any way possible.
102
+
103
+
Because of the way `ember-cli-deploy` merges return values of hooks back into the deployment context, you can easily add custom properties to the deployment context if that's what you need to do:
104
+
105
+
```javascript
106
+
ENV.slack= {
107
+
webhookURL:'<your-webhook-URI>',
108
+
willDeploy:function(context) {
109
+
returnfunction(slack) {
110
+
return {
111
+
slackStartDeployDate:newDate()
112
+
};
113
+
};
114
+
},
115
+
116
+
didDeploy:function(context) {
117
+
returnfunction(slack) {
118
+
var start =context.slackStartDeployDate;
119
+
var end =newDate();
120
+
var duration = (end - start) /1000;
121
+
122
+
returnslack.notify({
123
+
text:'Deploy took '+duration+' seconds'
124
+
});
125
+
};
126
+
}
127
+
}
128
+
```
102
129
103
130
Please see the [Slack API documentation for message formatting](https://api.slack.com/docs/formatting)
0 commit comments