A small CLI for automating releases based on conventional commits. It bumps versions, updates your changelog and publishes GitHub releases.
Note: This tool works with Yarn, npm and pnpm.
Install via npm:
npm install --save-dev @wroud/ciInstall via yarn:
yarn add --dev @wroud/ciInstall via pnpm:
pnpm add -D @wroud/ciFor detailed usage and API reference, visit the documentation site.
@wroud/ci looks for an optional wroud.ci.config.js file located next to the package.json it relates to. A minimal configuration may look like:
export default {
repository: "owner/repo", // used for changelog links
tagPrefix: "v", // prefix for git tags
packageManager: "npm", // npm | yarn | pnpm
};repositoryis required when publishing GitHub releases. It can also be provided via therepository.urlfield inpackage.json.tagPrefixsets the prefix for git tags. It can alternatively be defined inrelease.tagPrefixinsidepackage.json.packageManageris only needed if the package manager cannot be detected automatically. You can specify it here or via thepackageManagerfield inpackage.json.
Bump version and update changelog.
--prefixtag prefix (defaults to configured prefix)--change-log-filepath to changelog file--dry-runpreview actions without writing files
Create git tag for current version.
--prefixtag prefix (defaults to configured prefix)--dry-runpreview actions
Publish GitHub releases for new tags.
--prefixtag prefix (defaults to configured prefix)--dry-runpreview actions
- Install
@wroud/cias a dev dependency. - Add scripts to
package.json:
{
"scripts": {
"ci:release": "ci release",
"ci:git-tag": "ci git-tag",
"ci:release-github": "ci release-github" // optional
}
}-
Configure the repository URL and tag prefix in
package.jsonor in a localwroud.ci.config.jsfile next to it. -
Example GitHub Action (
.github/workflows/release.yml):
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v6
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn install --immutable
- run: yarn build
- run: yarn ci:release
- run: yarn ci:git-tag
- run: git push --follow-tags
- run: yarn ci:release-github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}- Install
@wroud/ciin each package that should be released. - Add scripts to each package's
package.jsonas shown above. - Configure a unique
tagPrefixfor every package using eitherrelease.tagPrefixin itspackage.jsonor an adjacentwroud.ci.config.jsfile. Ensurerepository.urlis set if GitHub releases are required. - Example GitHub Action for a monorepo:
name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v6
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn install --immutable
- run: yarn workspaces foreach -A --topological --no-private run ci:release
- run: git commit -m "chore: release" && yarn workspaces foreach -A --no-private run ci:git-tag
- run: git push --follow-tags
- run: yarn workspaces foreach -A --no-private run ci:release-github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: yarn workspaces foreach -A --topological --no-private npm publish --access public --tolerate-republish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}All notable changes to this project will be documented in the CHANGELOG file.
This project is licensed under the MIT License. See the LICENSE file for details.