publishit-cli
v1.0.0
Published
A CLI tool to automate versioning, changelog, GitHub release, and npm publish workflows.
Maintainers
Readme
publishit
A CLI tool to automate GitHub releases, npm publishing workflows, changelog generation, and versioning — all from a single command.
Table of Contents
- Installation
- Quick Start
- Commands
- Commit Message Rules
- Changelog Format
- GitHub Workflows
- Dependencies
- Project Requirements
Installation
Global (recommended)
npm i -g publishit-cliLocal
npm i publishit-cliThen use it via:
npx publishit <command>Quick Start
# 1. Generate GitHub release workflow
publishit generate github
# 2. Generate npm publish workflow
publishit generate npm
# 3. Preview what will happen before pushing
publishit push --preview
# 4. Stage, commit, tag, generate changelog, and push
publishit pushCommands
publishit push
The main command. It does the following in order:
- Checks
.git— verifies you are inside a Git repository. - Checks
package.json— verifies the file exists and hasnameandversionfields. - Checks staging area — shows staged and unstaged files.
- If there are unstaged files, you will be prompted to select which ones to add to staging.
- Commit message — opens your system editor to write a commit message (supports multiline).
- Checks tags — detects the latest tag and calculates the next version based on your commit messages.
- If no tags exist, it will suggest creating the first tag from
package.jsonversion.
- If no tags exist, it will suggest creating the first tag from
- Generates CHANGELOG — writes or updates
CHANGELOG.mdfrom commit history. - Updates versions — bumps
versioninpackage.jsonandpackage-lock.json. - Creates release commit — commits
CHANGELOG.md,package.json, andpackage-lock.jsonwith messagechore: release vX.X.X. - Creates tag — tags the release commit (so CHANGELOG is included in the tag).
- Pushes — pushes the current branch and all tags to
origin.
publishit pushpublishit push --preview
Runs a dry-run of publishit push. Nothing is committed, tagged, or pushed. It shows:
- Staged and unstaged files
- The next tag and version bump type (MAJOR / MINOR / PATCH)
- The new version number
- A preview of the CHANGELOG entry
- The branch and remote that will be pushed to
publishit push --previewpublishit generate github
Generates .github/workflows/release.yaml in the current directory.
This workflow:
- Triggers on
git pushwith a tag matchingv* - Extracts the changelog entry for the tag version from
CHANGELOG.md - Checks if a release for the tag already exists (skips if it does)
- Creates a GitHub Release with the changelog as the release description
If the file already exists, you will be prompted to:
- Overwrite — replace the existing file
- Rename — create a new file with a custom name
- Skip — do nothing
publishit generate githubPrerequisite: Go to your repository Settings > Actions > General > Workflow permissions and set it to Read and write permissions.
publishit generate npm
Generates .github/workflows/publish.yaml in the current directory.
This workflow:
- Triggers on
git pushwith a tag matchingv* - Checks if
NPM_TOKENsecret is set (skips with instructions if not) - Checks if the version is already published on npm (skips if it is)
- Publishes the package to npm with
--access public
If the file already exists, you will be prompted to overwrite, rename, or skip.
publishit generate npmPrerequisite: Add your npm Access Token as a repository secret named
NPM_TOKEN.
- Go to your repository Settings
- Under Security and quality, select Secrets and variables > Actions
- Select the Secrets tab
- Under Repository secrets, click New repository secret
- Set Name to
NPM_TOKEN- Set Secret to your npm Access Token (type: Automation)
Commit Message Rules
publishit follows the Conventional Commits specification to automatically determine the next version bump.
Format
<type>[optional scope][optional !]: <description>
[optional body]
[optional footer(s)]Version Bump Rules
| Bump | Trigger |
| --------- | ------------------------------------------------------------------------------------------------------ |
| MAJOR | Any commit with ! after the type/scope: feat!:, fix(auth)!: |
| MAJOR | Any commit with BREAKING CHANGE: in the footer |
| MINOR | Commits with type feat |
| PATCH | Everything else (fix, chore, docs, refactor, perf, test, style, build, ci, revert) |
Examples
PATCH bump — any type that is not feat and has no breaking change:
fix(auth): resolve token expiry issue
Updated the token refresh logic to handle edge cases.docs: update installation stepsrefactor(parser): simplify commit log parsingMINOR bump — type must be feat:
feat(cli): add --preview flag to push commandfeat: support pnpm lockfile version updateMAJOR bump — using ! after type or scope:
feat(api)!: redesign authentication workflowfix!: remove support for Node.js 14MAJOR bump — using BREAKING CHANGE: in footer:
feat(auth): migrate to OAuth2
Replaced the legacy session-based auth system with OAuth2.
BREAKING CHANGE: existing session tokens are no longer valid.
All clients must re-authenticate using the new OAuth2 endpoints.Multiline body with footer:
docs: rewrite contributing guide
- add commit message format section
- add branching strategy
REVIEWED BY: team-leadNote: The
chore: release vX.X.Xcommit created automatically bypublishitis excluded from CHANGELOG generation and version bump detection.
Changelog Format
publishit generates and maintains a CHANGELOG.md file in your project root following the Keep a Changelog format.
Each version entry groups commits by their type and separates them with ---:
## [1.2.0] - 2026-05-07
add new login flow ([abc1234](https://github.com/owner/repo/commit/abc1234...))
### Added
- implement email/password login
- add token refresh on expiry
REVIEWED BY: team
---
fix null pointer on logout ([def5678](https://github.com/owner/repo/commit/def5678...))
### Fixed
HOTFIX: critical null reference in session cleanup
---CHANGELOG sections
| Commit type | Section |
| ---------------------- | ---------------- |
| feat | Added |
| fix | Fixed |
| refactor | Changed |
| revert | Reverted |
| perf | Performance |
| docs | Documentation |
| style | Styling |
| test | Testing |
| chore, build, ci | Maintenance |
| Breaking changes | Breaking Changes |
GitHub Workflows
release.yaml
Triggered on push of any tag matching v*. Creates a GitHub Release using the CHANGELOG entry for that version as the release description.
.github/workflows/release.yamlGenerated by: publishit generate github
publish.yaml
Triggered on push of any tag matching v*. Publishes the package to the npm registry if NPM_TOKEN is set and the version has not been published before.
.github/workflows/publish.yamlGenerated by: publishit generate npm
Dependencies
| Package | Version | Purpose |
| --------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- |
| @inquirer/prompts | 8.4.2 | Interactive CLI prompts — checkbox for file selection, confirm dialogs, select menus, text input, and editor for commit messages |
| ora | 9.4.0 | Terminal spinner / loading indicators shown during git operations, changelog generation, and push |
Project Requirements
- Node.js
>= 18 - Git installed and configured
- A Git repository with a remote named
origin - A
package.jsonwithnameandversionfields
Uninstall / Removing
Uninstall
npm rm -g publishit-cliClear npm cache (optional)
npm cache clean --force