custom-deploy
v1.2.1
Published
CLI tool to build and send deployment artifacts via Telegram
Maintainers
Readme
custom-deploy
A small CLI tool that builds your project, zips the dist/ output, and sends it to a Telegram chat — handy for shipping deployment artifacts straight from your terminal.
It picks the build command based on the current git branch, archives the result, and uploads it to a Telegram bot along with a short status message (project name, branch, and the git user who triggered it).
Features
- 🔨 Branch-aware builds — runs
build-prodonPROD,buildonDEV - 📦 Zips the
dist/folder with maximum compression - 🤖 Sends the archive + a status message to Telegram
- 📁 Optional
-oflag to also copy the zip to a local folder (e.g.~/Downloads) - ❌ Reports failures back to Telegram automatically
Requirements
- Node.js >= 18
- A project with:
- a
package.jsoncontaining aname npm run buildand/ornpm run build-prodscripts- a
dist/folder produced by those builds
- a
- A Telegram bot token and chat ID
Installation
Install globally from npm:
npm install -g custom-deployThis exposes the deploy command anywhere on your system.
git clone https://github.com/davronkhamdamov/deploy.git
cd deploy
npm install -g .Configuration
Create a .env file in the directory where you run deploy:
BOT_TOKEN=123456789:your-telegram-bot-token
CHAT_ID=your-telegram-chat-id⚠️ Keep
.envout of version control — it contains secrets. (It's already in.gitignore.)
How to get these values:
BOT_TOKEN— create a bot via @BotFather and copy the token it gives you.CHAT_ID— message your bot, then visithttps://api.telegram.org/bot<BOT_TOKEN>/getUpdatesand read thechat.idfrom the response. For groups, add the bot to the group first.
Usage
Run the command from the root of the project you want to deploy, while on a
prod or dev branch:
deployOptions
| Flag | Description |
|------|-------------|
| -o, --output [dir] | After a successful build, also copy the zip to dir. If no path is given, defaults to ~/Downloads. |
Examples
# Build, zip, and send to Telegram
deploy
# Also copy the zip into ~/Downloads
deploy -o
# Copy the zip to a specific folder
deploy -o ~/Desktop/builds
# Long form
deploy --output /tmp/artifacts~ is expanded to your home directory, and the output folder is created if it
doesn't already exist. The original zip stays in the project root regardless.
How it works
- Reads the current git branch (
PROD→npm run build-prod,DEV→npm run build). - Runs the matching build command.
- Verifies
dist/exists, then zips it to<project-name>-<branch>.zip. - Sends a status message and the zip file to your Telegram chat.
- (Optional) Copies the zip to the
-ooutput folder.
If anything fails, the error is logged and a failure message is sent to Telegram.
Notes & limitations
- Only the
prodanddevbranches are supported; other branches throw an error. - A
dist/folder must be produced by your build for the upload to succeed. - Telegram caps bot uploads at 50 MB per file.
License
MIT © Davron Khamdamov
