/teams-deploy-notifier

CLI tool to notify your colleagues on MS Teams that you've deployed something

Primary LanguageJavaScriptMIT LicenseMIT

teams-deploy-notifier npm version

CLI tool to notify your colleagues on MS Teams that you've deployed something

Installation

npm install -g teams-deploy-notifier

Usage

  1. Create a .teams-notifier-config.json file in the root directory of your project. It should look similar to this:
{
  "projectName": "REQUIRED: the name of your project",
  "teamsUrl": "REQUIRED: your ms teams webhook url",
  "options": {
    "themeColor": "OPTIONAL: hex code for your color without the #"
  }
}
  1. When you are ready to deploy call the cli and optionally pass in the service, path, and git-commit options:

--service: the name of the service that you want to deploy with. Examples include now and netlify. This defaults to now.

--path: the path to the directory that you want to deploy. For example if you want to deploy the build directory you might pass in build if you wanted to deploy the current directory you might pass in .. This defaults to ..

--git-commit: how many git commit summaries you want to include in the notification. This includes the last n commits in the notification where n is the number you pass in. For example if you wanted only the latest commit you would pass in 1. If you wanted the last 5 commits you would pass in 5. If you do not want to include any commits in the notification then omit this argument (by default no commits are included in teh notification).

teams-deploy-notifier --service now --path build
  1. Thats it! On successful deploy and notification you will see the info from your service provider printed to the console as well as a green message saying Deployment message posted to Teams

API

CLI teams-deploy-notifier

  // Available Arguments
  // the path to the directory that you want to deploy. defaults to now
  "--path": String,
  // the service that you want to deploy with. defaults to the current directory (.)
  "--service": String,
  // the last n git commits to include in the notification. commits omitted from notification if number not specified
  "--git-commit": Number,

  // Aliases
  "-p": "--path",
  "-s": "--service",
  "-gc": "--git-commit"

Example with now:

teams-deploy-notifier --service now --path build --git-commit 5
# same as
teams-deploy-notifier -s now -p build -gc 5

Example with netlify:

teams-deploy-notifier --service netlify --path build --git-commit 5
# same as
teams-deploy-notifier -s netlify -p build -gc 5

If you do not pass in any arguments:

teams-deploy-notifier
# same as
teams-deploy-notifier --service now --path .
# notice that no commits will be included in the notification if you don't specify a number

Config File (.teams-notifier-config.json)

{
  "projectName": "REQUIRED: the name of your project",
  "teamsUrl": "REQUIRED: your ms teams webhook url",
  "options": {
    "themeColor": "OPTIONAL: hex code for your color without the #"
  }
}

Simple Example:

{
  "projectName": "Simple Sample Project",
  "teamsUrl": "https://outlook.office.com/webhook/xxx"
}

Configured Example:

{
  "projectName": "Configured Sample Project",
  "teamsUrl": "https://outlook.office.com/webhook/xxx",
  "options": {
    "themeColor": "4834d4"
  }
}

Supported Services

The following services have been tested with teams-deploy-notifier and are confirmed to work.

  • ZEIT now
    • Should work with no additional configuration
  • Netlify
    • Need to have a .netlify config file before attempting deployment

FAQ

License

MIT © Divyagnan Kandala