Giter Club home page Giter Club logo

sem-release-ms-teams's Introduction

semantic-release-ms-teams

semantic-release plugin to send release notes to a teams channel when the release succeeds.

Step Description
verifyConditions Check the webhookUrl option or TEAMS_WEBHOOK_URL variable.
generateNotes Allow sending release note to MS Teams in dry-run mode.
success Send a Teams message to notify of a new release.

Installation

npm install semantic-release-ms-teams --save-dev
# or
yarn add semantic-release-ms-teams --dev

This plugin is using an incoming webhook to notify a teams channel. Here is some documentation to create one.

Usage

// .releaserc.json
{
  "branches": ["main"],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["semantic-release-ms-teams", {
      "webhookUrl": "...",
      "title": "A new version has been released",
      "imageUrl": "http://...",
      "showContributors": false,
      "notifyInDryRun": true,
    }]
  ]
}
Variable Details Description
webhookUrl or TEAMS_WEBHOOK_URL required, url The incoming webhook url of the channel to publish release notes to.
webhookUrlDryRun or TEAMS_WEBHOOK_URL_DRYRUN optional, url Similar to webhookUrl or TEAMS_WEBHOOK_URL, but will be used in dryRun mode. Default: webhookUrl or TEAMS_WEBHOOK_URL
title optional, text The title of the message. Default: A new version has been released
imageUrl optional, url An image displayed in the message, next to the title. The image must be less than 200x200.
showContributors optional, boolean Whether or not the contributors should be displayed in the message. Default: true
notifyInDryRun optional, boolean Whether or not the release notes will be send to Teams when semantic-release runs in dry-run mode. Default: true

Notes

  • webhookUrl is a property of the config object in .releaserc.json, and, TEAMS_WEBHOOK_URL is an environment variable. The config object can be useful to try the plugin, but most of the time, production environments prefers environment variables. You can use both, but not in the same time as it does not make sense. If you do define both, the config object overrides the environment variable.

  • IMPORTANT: The webhookUrl variable you can use within your plugin configuration is meant to be used only for test purposes. Because you don't want to publicly publish this url and do let the world know a way to send messages to your teams channel, you will want to use the TEAMS_WEBHOOK_URL instead.

  • When in dry-run mode, here are the order of considered urls: webhookUrlDryRun, TEAMS_WEBHOOK_URL_DRY_RUN, webhookUrl, TEAMS_WEBHOOK_URL

  • The default value for imageUrl is https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Gitlab_meaningful_logo.svg/144px-Gitlab_meaningful_logo.svg.png

  • The list of Contributors is built using the email associated with the commits (only the part before the "@" is kept). This list can be disabled (mainly for privacy reasons).

  • The official @semantic-release/git plugin may cause a second message to be sent (because the plugin potentially adds a commit on the current branch, to save changes in files like package.json, package-lock.json, CHANGELOG.md). In order to prevent that, an environment variable (HAS_PREVIOUS_SEM_REL_EXECUTION) is set to true after the first message, then this plugin won't send any other message, as long as the plugin is part of the config.

Screenshots

preview preview

Development

Here are some steps to test the plugin locally:

  • checkout the source code:
    git clone [email protected]:sragot/semantic-release-ms-teams.git
    cd semantic-release-ms-teams
    npm install
  • create a personal access token in github, then export GH_TOKEN=...
  • run semantic-release locally safely:
    npm link
    npm link semantic-release-ms-teams
    npm run release -- --dry-run --no-ci

Dependencies

Greatly inspired by semantic-release-slack-bot ... Thanks ;)

sem-release-ms-teams's People

Contributors

yllieth avatar semantic-release-bot avatar sedx avatar pgoudreau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.