Socket
Book a DemoInstallSign in
Socket

semantic-release-tg

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semantic-release-tg

semantic-release plugin. Provides notifications to Telegram chats

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Fork from pustovitDmytro/semantic-release-telegram

Update telegram api version

semantic-release-tg

semantic-release plugin. Provides notifications to Telegram chats.

![Version][badge-vers] ![Downloads][npm-downloads-badge] ![Dependencies][badge-deps]

Table of Contents

Requirements

[![Platform Status][node-ver-test-badge]][node-ver-test-url]

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

  • node >=10
  • npm >=6

Package is [continuously tested][node-ver-test-url] on darwin, linux and 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-tg

Usage

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

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [ "semantic-release-tg", {
      "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-tg", {
      "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:

OptionRequiredTypeDescriptionDefault
namenostringHeroku application name.name from package.json
chatsyesarrayList of chats for sending. The bot should have access to each chat.
templates.successnostringHTML template, send in case of success.SUCCESS.html
templates.failnostringHTML template, send in case of fail.FAIL.html
assetsnoarrayList of files to upload. See Assets[]
telegra.phnoobjectPublish and attach Telegraph storynull

Template variables:

keyTemplatesDescriptionExample
repository_urlsuccess, failThe git repository URL. By default repository property in package.json or git origin urlhttps://github.com/ichirkin/semantic-release-tg
namesuccess, failapplication namefunny-app
versionsuccessnew version1.0.0
release_notessuccessgenerated notes
release_typesuccessminor
commitsuccesscommit hash13b16914f2893fa09e9a39f1dcda78af1fff0dbd
branchsuccess, failmaster
errorfailthrown errorSemanticReleaseError: 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

Assets

Can be glob or relative file path. name specifies file label in telegram. In the case of glob pattern, all files are uploaded in a single archive, name is required.

Example:

  "assets" : [
        { "path": "README.md" },
        { "glob": [ ".docs/*" ], "name": "Documentation.zip" }
    ]

Assets will be attached to release message as separate files.

Telegraph

Upload bulky markdowns, as telegra.ph stories. Use next api for this:

  "telegra.ph"  : {
    "title"   : "{name} v.{version}",
    "message" : "<a href='{telegraph_url}'>Release Notes</a>",
    "content" : "{release_notes}"
}

title and content represent story content.

message is a telegram message, sent to telegram chats (It is reasonable to include {telegraph_url} here). Success template is extended with new variables {telegraph_url} and {telegraph_title} when telegra.ph is used.

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.

Keywords

telegram

FAQs

Package last updated on 29 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.