semantic-release-telegram

semantic-release plugin. Provides notifications to Telegram chats

Usage no npm install needed!

<script type="module">
  import semanticReleaseTelegram from 'https://cdn.skypack.dev/semantic-release-telegram';
</script>

README

semantic-release-telegram

semantic-release plugin. Provides notifications to Telegram chats.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Total alerts Language grade Scrutinizer

Dependencies Security Build Status Coverage Status

Commit activity FOSSA License

Table of Contents

Requirements

Platform Status

To use library you need to have node and npm installed in your machine:

  • node >=10
  • npm >=6

Package is continuously tested on darwin, linux, win32 platforms. All active and maintenance LTS node releases are supported.

Installation

To install the library run the following command

  npm i --save semantic-release-telegram

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [ "semantic-release-telegram", {
      "chats": [ 123456789, -987654321 ]
    } ]
  ]
}

This is a minimal usage sample with a default configuration. Next messages will be sent:

Usage Sample

Configuration

if needed, the configuration can be extended:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["semantic-release-heroku", {
      "name": "funny-app",
      "chats": [ 123456789 ],
      "templates": {
        "fail"    : "An error occured while trying to publish the new version of <b>{name}</b>.\n<pre><code class='language-javascript'>{error}</code></pre>",
        "success" : "A new version of <a href='{repository_url}'>{name}</a> has been released. Current version is <b>{version}</b>"
      }

    }]
  ]
}

Config attribute description:

Option Required Type Description Default
name no string Heroku application name. name from package.json
chats yes array List of chats for sending. The bot should have access to each chat.
templates.success no string HTML template, send in case of success. SUCCESS.html
templates.fail no string HTML template, send in case of fail. FAIL.html

Template variables:

key Templates Description Example
repository_url success, fail The git repository URL. By default repository property in package.json or git origin url https://github.com/pustovitDmytro/semantic-release-telegram
name success, fail application name funny-app
version success new version 1.0.0
release_notes success generated notes
release_type success minor
commit success commit hash 13b16914f2893fa09e9a39f1dcda78af1fff0dbd
branch success, fail master
error fail thrown error SemanticReleaseError: Cannot push to the Git repository

Authentication

To use this package, you need to register a new telegram bot. Then pass the next environment variables:

  TELEGRAM_BOT_ID=123456 
  TELEGRAM_BOT_TOKEN=ABC-DEF1234ghIkl-zyx57W2v1u123ew11

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions. Read Contributing Guidelines for details.